Cerere modificare extraitem sa fie pentru vip

Categoria cu cereri de pluginuri si nu numai.

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Forum rules
Accesează link-ul pentru a putea vedea regulile forumului

Daca doriti sa vi se modifice un plugin, va rugam postati aici .
Post Reply
RyZeNNN
Membru, skill 0
Membru, skill 0
Posts: 19
Joined: 10 Nov 2019, 08:56
Detinator Steam: Nu
CS Status: Citesc forumul eXtreamCS.com...!
Detinator server CS: da
Fond eXtream: 0
Has thanked: 1 time
Been thanked: 1 time

05 Dec 2019, 01:30

salutare ma puteti va rog ajuta,vreau ca acest item sa apara in meniu vip (modzm)
#include < amxmodx >
#include < amxmisc >
#include < fun >
#include < engine >
#include < zombieplague >
#include < fakemeta >
#include < hamsandwich >
#include < xs >

const OFFSET_PAINSHOCK = 108 // ConnorMcLeod
const OFFSET_LINUX = 5
#define PLAYER_LINUX_XTRA_OFF 5
#define m_flNextAttack 83

#define ANIM_IDLESLASH 0
#define ANIM_SLASH 1
#define ANIM_SLASHE 2
#define ANIM_DRAW 3
#define ANIM_IDLESTAB 4
#define ANIM_STAB 5
#define ANIM_DRAWSTAB 6
#define ANIM_MOVESTAB 7
#define ANIM_MOVESLASH 8

new g_knifeid
new g_has_knife[33] , g_mode[33] , g_oldweap[33] , g_primaryattack[33]
new cvar_hammer_dmg , cvar_hammer_dmg2 , cvar_hammer_knockback , cvar_hammer_knockback2 , cvar_hammer_knockbackn , cvar_hammer_knockbackn2 , cvar_hammer_speed , cvar_hammer_speed2 , cvar_hammer_radius , cvar_hammer_radius2 , cvar_hammer_bloodsize
new spr_blood1 , spr_blood2
new Ham:Ham_Player_ResetMaxSpeed = Ham_Item_PreFrame
new knife_vmodel[64] = "models/zm/hammer/v_hammer.mdl"
new knife_pmodel[64] = "models/zm/hammer/p_hammer.mdl"
new knife_sway[64] = "zm/hammer/"

new const oldknife_sounds[][] =
{
"weapons/knife_deploy1.wav",
"weapons/knife_hit1.wav",
"weapons/knife_hit2.wav",
"weapons/knife_hit3.wav",
"weapons/knife_hit4.wav",
"weapons/knife_hitwall1.wav",
"weapons/knife_slash1.wav",
"weapons/knife_slash2.wav",
"weapons/knife_stab.wav"
}

new knife_sounds[4][100]

public plugin_init( )
{
register_plugin("[ZP] Knife Addon: Hammer","0.1","=)/Exolent[jNr]/CHyC")

g_knifeid = zp_register_extra_item("Hammer" , 1 ,ZP_TEAM_HUMAN);

RegisterHam(Ham_TakeDamage, "player", "fw_takedamage")
RegisterHam(Ham_TakeDamage, "player", "fw_takedamage_post",1)

register_forward(FM_EmitSound, "fw_emitsound")
register_forward(FM_CmdStart, "fw_cmdstart")
register_forward(FM_TraceLine, "fw_traceline")
register_forward(FM_UpdateClientData, "fw_updateclientdata_post", 1)
register_forward(FM_PlayerPreThink, "fw_playerprethink")
register_event("CurWeapon","ev_curweapon","be","1=1")

RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_knife", "fw_knifeprimpost", 1)
RegisterHam(Ham_Weapon_WeaponIdle,"weapon_knife","fw_knifeidleanim")
RegisterHam(Ham_TraceAttack,"player","fw_knifetraceattack")
RegisterHam(Ham_Spawn,"player","fw_spawnpost")

cvar_hammer_dmg = register_cvar("zp_hammer_dmg", "9.0")
cvar_hammer_dmg2 = register_cvar("zp_hammer_dmg2", "15.0")
cvar_hammer_knockback = register_cvar("zp_hammer_knockback", "10.0")
cvar_hammer_knockback2 = register_cvar("zp_hammer_knockback2", "20.0")
cvar_hammer_knockbackn = register_cvar("zp_hammer_nemknockback", "10.0")
cvar_hammer_knockbackn2 = register_cvar("zp_hammer_nemknockback2", "20.0")
cvar_hammer_speed = register_cvar("zp_hammer_speed", "320.0")
cvar_hammer_speed2 = register_cvar("zp_hammer_speed2", "100.0")
cvar_hammer_radius = register_cvar("zp_hammer_radius", "80.0")
cvar_hammer_radius2 = register_cvar("zp_hammer_radius2", "100.0")
cvar_hammer_bloodsize = register_cvar("zp_hammer_bloodsize", "8")
}

public plugin_precache()
{
precache_model(knife_vmodel)
precache_model(knife_pmodel)

spr_blood1 = precache_model("sprites/blood.spr")
spr_blood2 = precache_model("sprites/bloodspray.spr")

formatex(knife_sounds[0],99,"%shammer_draw.wav",knife_sway)
formatex(knife_sounds[1],99,"%shammer_hit_slash.wav",knife_sway)
formatex(knife_sounds[2],99,"%shammer_hit_stab.wav",knife_sway)
formatex(knife_sounds[3],99,"%shammer_swing.wav",knife_sway)

for(new i = 0; i < 4; i++)
precache_sound(knife_sounds)
}

public zp_extra_item_selected( id, itemid )
{
if(itemid == g_knifeid){
g_has_knife[id] = 1
g_mode[id] = 0
g_primaryattack[id] = 0
remove_task(id)

if(get_user_weapon(id) == CSW_KNIFE)
{
update_model(id)
util_playweaponanimation(id, ANIM_DRAW)
set_pdata_float(id, m_flNextAttack, 1.5 , PLAYER_LINUX_XTRA_OFF)
emit_sound(id, CHAN_WEAPON, knife_sounds[0], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
}
}
}

public fw_spawnpost(id)
{
if(!is_user_alive(id))
return;

g_oldweap[id] = get_user_weapon(id)
}

public fw_knifetraceattack(id, attacker, Float:dmg, Float:direction[3], pentru, dmgtype)
{
if(!is_user_alive(attacker) || !is_user_alive(id) || !zp_get_user_zombie(id) || zp_get_user_zombie(attacker) || get_user_weapon(attacker) != CSW_KNIFE || !g_has_knife[attacker] || g_mode[attacker] == 2 || g_mode[attacker] == 3 || g_mode[attacker] == 4)
return HAM_IGNORED;

new Float:end[3]
get_tr2(pentru, TR_vecEndPos, end);

message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
write_byte(TE_BLOODSPRITE)
engfunc(EngFunc_WriteCoord, end[0])
engfunc(EngFunc_WriteCoord, end[1])
engfunc(EngFunc_WriteCoord, end[2])
write_short(spr_blood1)
write_short(spr_blood2)
write_byte(249) // color index
write_byte(get_pcvar_num(cvar_hammer_bloodsize)) // size
message_end()

return HAM_SUPERCEDE;
}

public fw_emitsound(id, channel, const sound[])
{
if(!is_user_alive(id) || zp_get_user_zombie(id) || get_user_weapon(id) != CSW_KNIFE || !g_has_knife[id])
return FMRES_IGNORED

for(new i = 0; i < sizeof oldknife_sounds; i++)
{
if(equal(sound, oldknife_sounds))
{
if(i == 1|| i == 2 || i == 3 || i == 4 || i == 5 || i == 8)
{
if(g_mode[id] == 0) emit_sound(id, channel, knife_sounds[1], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
if(g_mode[id] == 1) emit_sound(id, channel, knife_sounds[2], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
}
if(i == 6|| i == 7)
{
emit_sound(id, channel, knife_sounds[3], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
}

return FMRES_SUPERCEDE
}
}

return FMRES_IGNORED
}

public fw_cmdstart(id, uc_handle, seed)
{
if(!is_user_alive(id) || zp_get_user_zombie(id) || !g_has_knife[id] || get_user_weapon(id) != CSW_KNIFE)
return FMRES_IGNORED;

new Float:flNextAttack = get_pdata_float(id, m_flNextAttack, PLAYER_LINUX_XTRA_OFF)

if(g_primaryattack[id] && !g_mode[id])
{
if(flNextAttack > 0.1)
return FMRES_IGNORED;

set_pdata_float(id, m_flNextAttack, 0.1, PLAYER_LINUX_XTRA_OFF)

return FMRES_SUPERCEDE;
}

if((get_uc(uc_handle, UC_Buttons) & IN_ATTACK) && !g_mode[id])
{
if(flNextAttack > 0.1)
return FMRES_IGNORED;

g_primaryattack[id] = 1
util_playweaponanimation(id, ANIM_SLASH)
remove_task(id)
set_task(1.0,"knife_attack",id)

set_pdata_float(id, m_flNextAttack, 0.1, PLAYER_LINUX_XTRA_OFF)
return FMRES_IGNORED;
}

if(g_primaryattack[id]) return FMRES_IGNORED;

if(get_uc(uc_handle, UC_Buttons) & IN_ATTACK)
{
if(g_mode[id] == 2 || g_mode[id] == 3 || g_mode[id] == 4)
{
if(flNextAttack > 0.1)
return FMRES_IGNORED;

set_pdata_float(id, m_flNextAttack, 0.1, PLAYER_LINUX_XTRA_OFF)
}

return FMRES_IGNORED;
}

if(flNextAttack > 0.1)
return FMRES_IGNORED;

if((get_uc(uc_handle, UC_Buttons) & IN_ATTACK2))
{
if(g_mode[id] == 0)
{
remove_task(id)
g_mode[id] = 2
util_playweaponanimation(id, ANIM_MOVESTAB)
set_task(1.4,"change_stab",id)
set_pdata_float(id, m_flNextAttack, 1.5, PLAYER_LINUX_XTRA_OFF)
}else if(g_mode[id] == 1){
remove_task(id)
g_mode[id] = 3
util_playweaponanimation(id, ANIM_MOVESLASH)
set_task(0.4,"change_slash1",id)
set_pdata_float(id, m_flNextAttack, 1.5, PLAYER_LINUX_XTRA_OFF)
}

set_pev(id, pev_button , pev(id,pev_button) & ~IN_ATTACK2)
return FMRES_SUPERCEDE;
}

return FMRES_IGNORED;
}

public fw_knifeprimpost(Weapon)
{
new id = get_pdata_cbase(Weapon, 41, 4)

if(!is_user_alive(id) || zp_get_user_zombie(id) || !g_has_knife[id] || get_user_weapon(id) != CSW_KNIFE)
return HAM_IGNORED;

if(g_mode[id])
{
util_playweaponanimation(id, ANIM_STAB)
set_pdata_float(id, m_flNextAttack, 2.0, PLAYER_LINUX_XTRA_OFF)
}

return HAM_IGNORED;
}

public fw_knifeidleanim(Weapon)
{
new id = get_pdata_cbase(Weapon, 41, 4)

if(!is_user_alive(id) || zp_get_user_zombie(id) || !g_has_knife[id] || get_user_weapon(id) != CSW_KNIFE)
return HAM_IGNORED;

if(g_mode[id] == 2 || g_mode[id] == 3 || g_mode[id] == 4 || g_primaryattack[id])
return HAM_SUPERCEDE;

if(g_mode[id] == 1)
{
util_playweaponanimation(id, ANIM_IDLESTAB)
return HAM_SUPERCEDE;
}

return HAM_IGNORED;
}

public ev_curweapon(id)
{
if(!is_user_alive(id) || zp_get_user_zombie(id))
return PLUGIN_CONTINUE

if(read_data(2) != CSW_KNIFE)
{
remove_task(id)
g_primaryattack[id] = 0
if(g_mode[id] == 3) g_mode[id] = 1
if(g_mode[id] == 4) g_mode[id] = 1
if(g_mode[id] == 2) g_mode[id] = 0
g_oldweap[id] = read_data(2)

return PLUGIN_CONTINUE
}

if(!g_has_knife[id])
return PLUGIN_CONTINUE

update_model(id)

if(g_oldweap[id] != CSW_KNIFE)
{
if(!g_mode[id])
{
util_playweaponanimation(id, ANIM_DRAW)
set_pdata_float(id, m_flNextAttack, 1.5 , PLAYER_LINUX_XTRA_OFF)
emit_sound(id, CHAN_WEAPON, knife_sounds[0], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
}else{
util_playweaponanimation(id, ANIM_DRAWSTAB)
set_pdata_float(id, m_flNextAttack, 1.5 , PLAYER_LINUX_XTRA_OFF)
emit_sound(id, CHAN_WEAPON, knife_sounds[0], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
}
}

g_oldweap[id] = read_data(2)

return PLUGIN_CONTINUE
}

public change_stab(id)
{
if(!is_user_alive(id) || zp_get_user_zombie(id) || !g_has_knife[id] || get_user_weapon(id) != CSW_KNIFE)
return PLUGIN_CONTINUE;

g_mode[id] = 1

return PLUGIN_CONTINUE;
}

public change_slash1(id)
{
if(!is_user_alive(id) || zp_get_user_zombie(id) || !g_has_knife[id] || get_user_weapon(id) != CSW_KNIFE)
return PLUGIN_CONTINUE;

g_mode[id] = 4
set_task(1.0,"change_slash2",id)

return PLUGIN_CONTINUE;
}

public change_slash2(id)
{
if(!is_user_alive(id) || zp_get_user_zombie(id) || !g_has_knife[id] || get_user_weapon(id) != CSW_KNIFE)
return PLUGIN_CONTINUE;

g_mode[id] = 0

return PLUGIN_CONTINUE;
}

public fw_takedamage(victim, inflictor, attacker, Float:damage)
{
if(!is_user_alive(attacker) || !is_user_alive(victim) || zp_get_user_zombie(attacker) || !g_has_knife[attacker] || get_user_weapon(attacker) != CSW_KNIFE || victim == attacker || !zp_get_user_zombie(victim))
return HAM_IGNORED;

if(g_mode[attacker] == 2 || g_mode[attacker] == 3)
return HAM_SUPERCEDE;

if(g_mode[attacker] == 0) SetHamParamFloat(4, damage * get_pcvar_float(cvar_hammer_dmg))

if(g_mode[attacker] == 1) SetHamParamFloat(4, damage * get_pcvar_float(cvar_hammer_dmg2))

new Float:vec[3], Float:oldvelo[3]
get_user_velocity(victim, oldvelo)
create_velocity_vector(victim , attacker , vec)
vec[0] += oldvelo[0]
vec[1] += oldvelo[1]
set_user_velocity(victim , vec)

return HAM_IGNORED;
}

public fw_takedamage_post(victim, inflictor, attacker, Float:damage)
{
if(!is_user_alive(attacker) || !is_user_alive(victim) || zp_get_user_zombie(attacker) || !g_has_knife[attacker] || get_user_weapon(attacker) != CSW_KNIFE || victim == attacker || !zp_get_user_zombie(victim))
return;

if(zp_get_user_nemesis(victim))
{
if(g_mode[attacker] == 0 && get_pcvar_num(cvar_hammer_knockbackn) > 0)
{
set_pdata_float(victim, OFFSET_PAINSHOCK, 1.0, OFFSET_LINUX)
}
if(g_mode[attacker] == 1 && get_pcvar_num(cvar_hammer_knockbackn2) > 0)
{
set_pdata_float(victim, OFFSET_PAINSHOCK, 1.0, OFFSET_LINUX)
}
}

if(!zp_get_user_nemesis(victim))
{
if(g_mode[attacker] == 0)
{
set_pdata_float(victim, OFFSET_PAINSHOCK, 1.0, OFFSET_LINUX)
}
if(g_mode[attacker] == 1)
{
set_pdata_float(victim, OFFSET_PAINSHOCK, 1.0, OFFSET_LINUX)
}
}

return;
}

public fw_traceline(Float:vector_start[3], Float:vector_end[3], ignored_monster, id, handle)
{
if (!is_user_alive(id) || zp_get_user_zombie(id))
return FMRES_IGNORED;

if (!g_has_knife[id] || g_mode[id] == 2|| g_mode[id] == 3 || get_user_weapon(id) != CSW_KNIFE)
return FMRES_IGNORED;

pev(id, pev_v_angle, vector_end)
angle_vector(vector_end, ANGLEVECTOR_FORWARD, vector_end)

if(g_mode[id] == 0) xs_vec_mul_scalar(vector_end, get_pcvar_float(cvar_hammer_radius), vector_end)
if(g_mode[id] == 1) xs_vec_mul_scalar(vector_end, get_pcvar_float(cvar_hammer_radius2), vector_end)

xs_vec_add(vector_start, vector_end, vector_end)
engfunc(EngFunc_TraceLine, vector_start, vector_end, ignored_monster, id, handle)

return FMRES_SUPERCEDE;
}

public update_model(id)
{
if(!is_user_alive(id) || zp_get_user_zombie(id) || !g_has_knife[id] || get_user_weapon(id) != CSW_KNIFE)
return PLUGIN_CONTINUE;

entity_set_string(id, EV_SZ_viewmodel, knife_vmodel)
entity_set_string(id, EV_SZ_weaponmodel, knife_pmodel)

return PLUGIN_CONTINUE;
}

public clear_values(id)
{
g_has_knife[id] = 0
g_mode[id] = 0
g_primaryattack[id] = 0
g_oldweap[id] = -3
remove_task(id)
}

public knife_attack(id)
{
if(!is_user_alive(id) || zp_get_user_zombie(id) || !g_has_knife[id] || get_user_weapon(id) != CSW_KNIFE || g_mode[id])
return;

new knife = find_ent_by_owner ( -1, "weapon_knife", id )

ExecuteHam(Ham_Weapon_PrimaryAttack, knife)

g_primaryattack[id] = 2
remove_task(id)
set_task(1.0,"knife_clear",id)
set_pdata_float(id, m_flNextAttack, 1.0, PLAYER_LINUX_XTRA_OFF)
util_playweaponanimation(id, ANIM_SLASHE)
}

public knife_clear(id)
{
if(!is_user_alive(id) || zp_get_user_zombie(id) || !g_has_knife[id] || get_user_weapon(id) != CSW_KNIFE || g_mode[id])
return;

g_primaryattack[id] = 0
}

public fw_updateclientdata_post(Player, SendWeapons, CD_Handle)
{
if(!is_user_alive(Player) || get_user_weapon(Player) != CSW_KNIFE || !g_has_knife[Player])
return FMRES_IGNORED

set_cd(CD_Handle, CD_flNextAttack, halflife_time() + 0.001 )

if(get_cd(CD_Handle, CD_WeaponAnim) != ANIM_MOVESTAB && g_mode[Player] == 2)
{
set_cd(CD_Handle, CD_WeaponAnim, ANIM_MOVESTAB);
return FMRES_SUPERCEDE;
}

if(get_cd(CD_Handle, CD_WeaponAnim) != ANIM_MOVESLASH && g_mode[Player] == 3)
{
set_cd(CD_Handle, CD_WeaponAnim, ANIM_MOVESLASH);
return FMRES_SUPERCEDE;
}

return FMRES_HANDLED
}

public fw_playerprethink(id)
{
if(!is_user_alive(id) || zp_get_user_zombie(id) || !g_has_knife[id])
return PLUGIN_CONTINUE
if(get_user_weapon(id) != CSW_KNIFE){
ExecuteHamB(Ham_Player_ResetMaxSpeed, id)
return PLUGIN_CONTINUE
}

if(pev(id, pev_maxspeed) == 1.0)
return PLUGIN_CONTINUE

if(g_mode[id] == 0) set_pev(id, pev_maxspeed, get_pcvar_float(cvar_hammer_speed))
if(g_mode[id] == 1) set_pev(id, pev_maxspeed, get_pcvar_float(cvar_hammer_speed2))
if(g_mode[id] == 2) set_pev(id, pev_maxspeed, get_pcvar_float(cvar_hammer_speed2))
if(g_mode[id] == 3) set_pev(id, pev_maxspeed, get_pcvar_float(cvar_hammer_speed2))
if(g_mode[id] == 4) set_pev(id, pev_maxspeed, get_pcvar_float(cvar_hammer_speed))

return PLUGIN_CONTINUE
}

stock util_playweaponanimation(const Player, const Sequence)
{
set_pev(Player, pev_weaponanim, Sequence)

message_begin(MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, .player = Player)
write_byte(Sequence)
write_byte(pev(Player, pev_body))
message_end()
}

stock create_velocity_vector(victim,attacker,Float:velocity[3])
{
if(!is_user_alive(attacker) || zp_get_user_zombie(attacker) || !g_has_knife[attacker] || get_user_weapon(attacker) != CSW_KNIFE || !is_user_alive(victim) || !zp_get_user_zombie(victim))
return 0;

new knockback = 0

if(!zp_get_user_nemesis(victim))
{
if(!g_mode[attacker])
{
knockback = get_pcvar_num(cvar_hammer_knockback)
}else{
knockback = get_pcvar_num(cvar_hammer_knockback2)
}
}else{
if(!g_mode[attacker])
{
knockback = get_pcvar_num(cvar_hammer_knockbackn)
}else{
knockback = get_pcvar_num(cvar_hammer_knockbackn2)
}
}

if(knockback == 0)
return 0 ;

new Float:vicorigin[3];
new Float:attorigin[3];
entity_get_vector(victim , EV_VEC_origin , vicorigin);
entity_get_vector(attacker , EV_VEC_origin , attorigin);

new Float:origin2[3]
origin2[0] = vicorigin[0] - attorigin[0];
origin2[1] = vicorigin[1] - attorigin[1];

new Float:largestnum = 0.0;

if(floatabs(origin2[0])>largestnum) largestnum = floatabs(origin2[0]);
if(floatabs(origin2[1])>largestnum) largestnum = floatabs(origin2[1]);

origin2[0] /= largestnum;
origin2[1] /= largestnum;

velocity[0] = ( origin2[0] * (knockback * 3000) ) / get_entity_distance(victim , attacker);
velocity[1] = ( origin2[1] * (knockback * 3000) ) / get_entity_distance(victim , attacker);
if(velocity[0] <= 20.0 || velocity[1] <= 20.0)
velocity[2] = random_float(200.0 , 275.0);

return 1;
}

public client_disconnect(id) clear_values(id)
public client_connect(id) clear_values(id)
public zp_user_infected_post(id) clear_values(id)
Post Reply

Return to “Cereri”

  • Information