- Código:
#include <amxmodx>
#include < fun >
#include <engine>
#include <hamsandwich>
#include <zombie_plague_advance>
#include <cstrike>
#define PLUGIN "[ZP] Flame XM1014"
#define VERSION "1.0"
#define AUTHOR "Javivi"
new g_MaxPlayers
#define IsValidUser(%1) (1 <= %1 <= g_MaxPlayers)
#define WEAPON_COST 12
new const burn_sounds[ ][ ] =
{
"zombie_plague/zombie_burn3.wav",
"zombie_plague/zombie_burn4.wav",
"zombie_plague/zombie_burn5.wav",
"zombie_plague/zombie_burn6.wav",
"zombie_plague/zombie_burn7.wav"
}
new g_ItemID, sprFlame, sprSmoke
new bool:g_bFlameXM1014[ 33 ]
new bool:g_AlreadyBurn[ 33 ]
new cvar_MaxBurnDMG, cvar_MinBurnDMG, cvar_BurnTime, cvar_Delay, cvar_OneRound
new cvar_cMaxBurnDMG, cvar_cMinBurnDMG, cvar_cBurnTime, Float:cvar_cDelay
new Time[ 33 ]
public plugin_init( )
{
register_plugin( PLUGIN, VERSION, AUTHOR )
g_MaxPlayers = get_maxplayers( )
cvar_MaxBurnDMG = register_cvar( "zp_flamexm_maxdmg", "80" )
cvar_MinBurnDMG = register_cvar( "zp_flamexm_mindmg", "60" )
cvar_BurnTime = register_cvar( "zp_flamexm_time", "20" )
cvar_Delay = register_cvar( "zp_flamexm_delay", "1.0" )
cvar_OneRound = register_cvar( "zp_flamexm_oneround", "0" )
register_event( "HLTV", "event_round_start", "a", "1=0", "2=0" )
register_clcmd( "drop", "HookDrop" )
g_ItemID = zp_register_extra_item( "Flame XM1014", WEAPON_COST, ZP_TEAM_HUMAN )
RegisterHam( Ham_Spawn, "player", "fw_PlayerSpawn_Post", 1 )
RegisterHam( Ham_Killed, "player", "fw_PlayerKilled_Post", 1 )
RegisterHam( Ham_TakeDamage, "player", "fw_TakeDamage" )
static szCvar[ 30 ]
formatex( szCvar, charsmax(szCvar), "v%s by Javivi", VERSION )
register_cvar( "zp_flamexm_version", szCvar, FCVAR_SERVER|FCVAR_SPONLY )
}
public plugin_precache( )
{
sprFlame = precache_model( "sprites/[DH]Flame.spr" )
sprSmoke = precache_model( "sprites/black_smoke3.spr" )
for( new i = 0; i < sizeof burn_sounds; i++ )
precache_sound( burn_sounds[ i ] )
}
public event_round_start( )
{
cvar_cMaxBurnDMG = get_pcvar_num( cvar_MaxBurnDMG )
cvar_cMinBurnDMG = get_pcvar_num( cvar_MinBurnDMG )
cvar_cBurnTime = get_pcvar_num( cvar_BurnTime )
cvar_cDelay = get_pcvar_float( cvar_Delay )
}
public client_disconnect( id )
{
if( g_bFlameXM1014[ id ] )
g_bFlameXM1014[ id ] = false
Time[ id ] = 0
}
public HookDrop( id )
{
if(is_user_alive( id ) && get_user_weapon( id ) == CSW_XM1014 && g_bFlameXM1014 [ id ] )
{
g_bFlameXM1014[ id ] = false
}
}
public zp_extra_item_selected( id, itemid )
{
if( itemid == g_ItemID )
{
if( !zp_has_round_started( ) || g_bFlameXM1014[ id ] )
{
#if defined OLD_VERSION
zp_set_user_ammo_packs( id, zp_get_user_ammo_packs(id) + WEAPON_COST )
#else
return ZP_PLUGIN_HANDLED
#endif
}
else
{
give_item( id, "weapon_xm1014" )
cs_set_user_bpammo(id, CSW_XM1014, 32)
g_bFlameXM1014[ id ] = true
}
}
return PLUGIN_HANDLED;
}
public zp_user_infected_post( id )
{
if( g_bFlameXM1014[ id ] )
g_bFlameXM1014[ id ] = false
}
public fw_PlayerSpawn_Post( id )
{
if( get_pcvar_num( cvar_OneRound ) == 1 && g_bFlameXM1014[ id ] )
{
g_bFlameXM1014[ id ] = false
}
}
public fw_PlayerKilled_Post( victim, attacker, shouldgib )
{
if(g_bFlameXM1014[ victim ] )
g_bFlameXM1014[ victim ] = false
}
public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type)
{
if(IsValidUser( attacker ) && victim != attacker && zp_get_user_zombie( victim )
&& g_bFlameXM1014[ attacker ] && get_user_weapon( attacker ) == CSW_XM1014 && !g_AlreadyBurn[ victim ] )
{
if(zp_get_user_nemesis(victim) || zp_get_user_assassin(victim))
{
return HAM_IGNORED
}
g_AlreadyBurn[ victim ] = true
Time[ victim ] = cvar_cBurnTime
Burn( victim )
emit_sound( victim, CHAN_VOICE, burn_sounds[random_num(0, sizeof burn_sounds - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM )
}
return PLUGIN_CONTINUE
}
public Burn( victim )
{
static Origin[ 3 ] ; get_user_origin( victim, Origin )
if( Time[ victim ] <= 0 || get_entity_flags( victim ) & FL_INWATER )
{
message_begin( MSG_PVS, SVC_TEMPENTITY, Origin )
write_byte( TE_SMOKE )
write_coord( Origin[0] )
write_coord( Origin[1] )
write_coord( Origin[2]-50 )
write_short( sprSmoke )
write_byte( random_num(15, 20) )
write_byte( random_num(10, 20) )
message_end( )
set_task( cvar_cDelay, "Stop", victim )
return
}
else
{
if( cvar_cBurnTime / 2 == Time[ victim ])
{
emit_sound( victim, CHAN_VOICE, burn_sounds[random_num(0, sizeof burn_sounds - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM )
}
message_begin( MSG_PVS, SVC_TEMPENTITY, Origin )
write_byte( TE_SPRITE )
write_coord( Origin[0]+random_num(-5, 5) )
write_coord( Origin[1]+random_num(-5, 5) )
write_coord( Origin[2]+random_num(-10, 10) )
write_short( sprFlame )
write_byte( random_num(5, 10) )
write_byte( 200 )
message_end( )
Time[ victim ]--
set_user_health( victim, get_user_health( victim ) - random_num( cvar_cMinBurnDMG, cvar_cMaxBurnDMG ) )
set_task( 0.5, "Burn", victim )
}
}
public Stop( victim )
g_AlreadyBurn[ victim ] = false
Esse item não ira buga o nemesis eh assassino