Alguém poderia me passar, fazendo uma grande ajuda a Destroyer Ak-47, Por favor
Código:
#include <amxmodx>
#include <fakemeta>
#include < fun >
#include <hamsandwich>
#include <cstrike>
#include <zombieplague>
#define is_valid_player(%1) (1 <= %1 <= 32)
//new AK_V_MODEL[64] = "models/zombie_plague/v_golden_ak47.mdl"
//new AK_P_MODEL[64] = "models/zombie_plague/p_golden_ak47.mdl"
new AK_V_MODEL[64] = "models/v_ak47.mdl"
new AK_P_MODEL[64] = "models/p_ak47.mdl"
new cvar_dmgmultiplier, cvar_goldbullets, cvar_custommodel
new g_itemid
new bool:g_HasAk[33]
new g_hasZoom[ 33 ]
new bullets[ 33 ]
new m_spriteTexture
const Wep_ak47 = ((1<<CSW_AK47))
public plugin_init()
{
cvar_dmgmultiplier = register_cvar("zp_goldenak_dmg_multiplier", "5")
cvar_custommodel = register_cvar("zp_goldenak_custom_model", "1")
cvar_goldbullets = register_cvar("zp_goldenak_gold_bullets", "1")
register_plugin("[ZP] Extra: Ak47 Destroyer", "1.1", "AlejandroSk")
g_itemid = zp_register_extra_item("Ak47 Destroyer", 30, ZP_TEAM_HUMAN)
register_event("DeathMsg", "Death", "a")
register_event("WeapPickup","checkModel","b","1=19")
register_event("CurWeapon","checkWeapon","be","1=1")
register_event("CurWeapon", "make_tracer", "be", "1=1", "3>0")
RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
register_forward( FM_CmdStart, "fw_CmdStart" )
RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1)
}
public plugin_precache()
{
precache_model(AK_V_MODEL)
precache_model(AK_P_MODEL)
m_spriteTexture = precache_model("sprites/dot.spr")
precache_sound("weapons/zoom.wav")
}
public client_connect(id)
{
g_HasAk[id] = false
}
public client_disconnect(id)
{
g_HasAk[id] = false
}
public Death()
{
g_HasAk[read_data(2)] = false
}
public fwHamPlayerSpawnPost(id)
{
g_HasAk[id] = false
}
public zp_user_infected_post(id)
{
if (zp_get_user_zombie(id))
{
g_HasAk[id] = false
}
}
public checkModel(id)
{
if ( zp_get_user_zombie(id) )
return PLUGIN_HANDLED
new szWeapID = read_data(2)
if ( szWeapID == CSW_AK47 && g_HasAk[id] == true && get_pcvar_num(cvar_custommodel) )
{
set_pev(id, pev_viewmodel2, AK_V_MODEL)
set_pev(id, pev_weaponmodel2, AK_P_MODEL)
}
return PLUGIN_HANDLED
}
public checkWeapon(id)
{
new plrClip, plrAmmo, plrWeap[32]
new plrWeapId
plrWeapId = get_user_weapon(id, plrClip , plrAmmo)
if (plrWeapId == CSW_AK47 && g_HasAk[id])
{
checkModel(id)
}
else
{
return PLUGIN_CONTINUE
}
{
get_weaponname(plrWeapId, plrWeap, 31)
give_item(id, plrWeap)
engclient_cmd(id, plrWeap)
engclient_cmd(id, plrWeap)
engclient_cmd(id, plrWeap)
}
return PLUGIN_HANDLED
}
public fw_TakeDamage(victim, inflictor, attacker, Float:damage)
{
if ( is_valid_player( attacker ) && get_user_weapon(attacker) == CSW_AK47 && g_HasAk[attacker] )
{
SetHamParamFloat(4, damage * get_pcvar_float( cvar_dmgmultiplier ) )
}
}
public fw_CmdStart( id, uc_handle, seed )
{
if( !is_user_alive( id ) )
return PLUGIN_HANDLED
if( ( get_uc( uc_handle, UC_Buttons ) & IN_ATTACK2 ) && !( pev( id, pev_oldbuttons ) & IN_ATTACK2 ) )
{
new szClip, szAmmo
new szWeapID = get_user_weapon( id, szClip, szAmmo )
if( szWeapID == CSW_AK47 && g_HasAk[id] == true && !g_hasZoom[id] == true)
{
g_hasZoom[id] = true
cs_set_user_zoom( id, CS_SET_AUGSG552_ZOOM, 0 )
emit_sound( id, CHAN_ITEM, "weapons/zoom.wav", 0.20, 2.40, 0, 100 )
}
else if ( szWeapID == CSW_AK47 && g_HasAk[id] == true && g_hasZoom[id])
{
g_hasZoom[ id ] = false
cs_set_user_zoom( id, CS_RESET_ZOOM, 0 )
}
}
return PLUGIN_HANDLED
}
public make_tracer(id)
{
if (get_pcvar_num(cvar_goldbullets))
{
new clip,ammo
new wpnid = get_user_weapon(id,clip,ammo)
new pteam[16]
get_user_team(id, pteam, 15)
if ((bullets[id] > clip) && (wpnid == CSW_AK47) && g_HasAk[id])
{
new vec1[3], vec2[3]
get_user_origin(id, vec1, 1)
get_user_origin(id, vec2, 4)
message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
write_byte (0)
write_coord(vec1[0])
write_coord(vec1[1])
write_coord(vec1[2])
write_coord(vec2[0])
write_coord(vec2[1])
write_coord(vec2[2])
write_short( m_spriteTexture )
write_byte(1)
write_byte(5)
write_byte(2)
write_byte(10)
write_byte(0)
write_byte(255)
write_byte(0)
write_byte(0)
write_byte(200)
write_byte(150)
message_end()
}
bullets[id] = clip
}
}
public zp_extra_item_selected(player, itemid)
{
if ( itemid == g_itemid )
{
if ( user_has_weapon(player, CSW_AK47) )
{
drop_prim(player)
}
give_item(player, "weapon_ak47")
client_print(player, print_chat, "[ZP] Voce Comprou a Ak47 Destroyer")
g_HasAk[player] = true;
}
}
stock drop_prim(id)
{
new weapons[32], num
get_user_weapons(id, weapons, num)
for (new i = 0; i < num; i++) {
if (Wep_ak47 & (1<<weapons[i]))
{
static wname[32]
get_weaponname(weapons[i], wname, sizeof wname - 1)
engclient_cmd(id, "drop", wname)
}
}
}
Código:
#include <amxmodx>
#include <fakemeta>
#include < fun >
#include <hamsandwich>
#include <cstrike>
#include <zombieplague>
#define is_valid_player(%1) (1 <= %1 <= 32)
new AK_V_MODEL[64] = "models/zombie_plague/v_golden_ak47.mdl"
new AK_P_MODEL[64] = "models/zombie_plague/p_golden_ak47.mdl"
//new AK_V_MODEL[64] = "models/v_ak47.mdl"
//new AK_P_MODEL[64] = "models/p_ak47.mdl"
new cvar_dmgmultiplier, cvar_goldbullets, cvar_custommodel
new g_itemid
new bool:g_HasAk[33]
new g_hasZoom[ 33 ]
new bullets[ 33 ]
new m_spriteTexture
const Wep_ak47 = ((1<<CSW_AK47))
public plugin_init()
{
cvar_dmgmultiplier = register_cvar("zp_goldenak_dmg_multiplier", "5")
cvar_custommodel = register_cvar("zp_goldenak_custom_model", "1")
cvar_goldbullets = register_cvar("zp_goldenak_gold_bullets", "1")
register_plugin("[ZP] Extra: Ak47 Destroyer", "1.1", "AlejandroSk")
g_itemid = zp_register_extra_item("Ak47 Destroyer", 30, ZP_TEAM_HUMAN)
register_event("DeathMsg", "Death", "a")
register_event("WeapPickup","checkModel","b","1=19")
register_event("CurWeapon","checkWeapon","be","1=1")
register_event("CurWeapon", "make_tracer", "be", "1=1", "3>0")
RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
register_forward( FM_CmdStart, "fw_CmdStart" )
RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1)
}
public plugin_precache()
{
precache_model(AK_V_MODEL)
precache_model(AK_P_MODEL)
m_spriteTexture = precache_model("sprites/dot.spr")
precache_sound("weapons/zoom.wav")
}
public client_connect(id)
{
g_HasAk[id] = false
}
public client_disconnect(id)
{
g_HasAk[id] = false
}
public Death()
{
g_HasAk[read_data(2)] = false
}
public fwHamPlayerSpawnPost(id)
{
g_HasAk[id] = false
}
public zp_user_infected_post(id)
{
if (zp_get_user_zombie(id))
{
g_HasAk[id] = false
}
}
public checkModel(id)
{
if ( zp_get_user_zombie(id) )
return PLUGIN_HANDLED
new szWeapID = read_data(2)
if ( szWeapID == CSW_AK47 && g_HasAk[id] == true && get_pcvar_num(cvar_custommodel) )
{
set_pev(id, pev_viewmodel2, AK_V_MODEL)
set_pev(id, pev_weaponmodel2, AK_P_MODEL)
}
return PLUGIN_HANDLED
}
public checkWeapon(id)
{
new plrClip, plrAmmo, plrWeap[32]
new plrWeapId
plrWeapId = get_user_weapon(id, plrClip , plrAmmo)
if (plrWeapId == CSW_AK47 && g_HasAk[id])
{
checkModel(id)
}
else
{
return PLUGIN_CONTINUE
}
{
get_weaponname(plrWeapId, plrWeap, 31)
give_item(id, plrWeap)
engclient_cmd(id, plrWeap)
engclient_cmd(id, plrWeap)
engclient_cmd(id, plrWeap)
}
return PLUGIN_HANDLED
}
public fw_TakeDamage(victim, inflictor, attacker, Float:damage)
{
if ( is_valid_player( attacker ) && get_user_weapon(attacker) == CSW_AK47 && g_HasAk[attacker] )
{
SetHamParamFloat(4, damage * get_pcvar_float( cvar_dmgmultiplier ) )
}
}
public fw_CmdStart( id, uc_handle, seed )
{
if( !is_user_alive( id ) )
return PLUGIN_HANDLED
if( ( get_uc( uc_handle, UC_Buttons ) & IN_ATTACK2 ) && !( pev( id, pev_oldbuttons ) & IN_ATTACK2 ) )
{
new szClip, szAmmo
new szWeapID = get_user_weapon( id, szClip, szAmmo )
if( szWeapID == CSW_AK47 && g_HasAk[id] == true && !g_hasZoom[id] == true)
{
g_hasZoom[id] = true
cs_set_user_zoom( id, CS_SET_AUGSG552_ZOOM, 0 )
emit_sound( id, CHAN_ITEM, "weapons/zoom.wav", 0.20, 2.40, 0, 100 )
}
else if ( szWeapID == CSW_AK47 && g_HasAk[id] == true && g_hasZoom[id])
{
g_hasZoom[ id ] = false
cs_set_user_zoom( id, CS_RESET_ZOOM, 0 )
}
}
return PLUGIN_HANDLED
}
public make_tracer(id)
{
if (get_pcvar_num(cvar_goldbullets))
{
new clip,ammo
new wpnid = get_user_weapon(id,clip,ammo)
new pteam[16]
get_user_team(id, pteam, 15)
if ((bullets[id] > clip) && (wpnid == CSW_AK47) && g_HasAk[id])
{
new vec1[3], vec2[3]
get_user_origin(id, vec1, 1)
get_user_origin(id, vec2, 4)
message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
write_byte (0)
write_coord(vec1[0])
write_coord(vec1[1])
write_coord(vec1[2])
write_coord(vec2[0])
write_coord(vec2[1])
write_coord(vec2[2])
write_short( m_spriteTexture )
write_byte(1)
write_byte(5)
write_byte(2)
write_byte(10)
write_byte(0)
write_byte(255)
write_byte(0)
write_byte(0)
write_byte(200)
write_byte(150)
message_end()
}
bullets[id] = clip
}
}
public zp_extra_item_selected(player, itemid)
{
if ( itemid == g_itemid )
{
if ( user_has_weapon(player, CSW_AK47) )
{
drop_prim(player)
}
give_item(player, "weapon_ak47")
client_print(player, print_chat, "[ZP] Voce Comprou a Ak47 Destroyer")
g_HasAk[player] = true;
}
}
stock drop_prim(id)
{
new weapons[32], num
get_user_weapons(id, weapons, num)
for (new i = 0; i < num; i++) {
if (Wep_ak47 & (1<<weapons[i]))
{
static wname[32]
get_weaponname(weapons[i], wname, sizeof wname - 1)
engclient_cmd(id, "drop", wname)
}
}
}
[D]etonado[R] escreveu:[url=http://Blog bloqueado, siga as regras do f%C3%B3rum./2013/09/zp-extra-item-destroyer-ak47.html]http://Blog bloqueado, siga as regras do fórum./2013/09/zp-extra-item-destroyer-ak47.html[/url]
Essa aqui :D
|
|