Senior Member
Join Date: Dec 2013
Location: Romania
|
12-28-2015
, 04:40
Re: [HELP] Zombie classes
|
#3
|
Try this out
Quote:
#include <amxmodx>
#include <engine>
#include <zombieplague>
new Float:next_fart[33]
new farts_count[33]
new fart_spr
new bool:wait_damage[33]
new g_zclass_gas
// Gas Zombie Atributes
new const zclass_name[] = { "Smoker-Zombie" } // name
new const zclass_info[] = { "Can Creat Smoke Screen" } // description
new const zclass_model[] = { "m003" } // model
new const zclass_clawmodel[] = { "v_zombie.mdl" } // claw model
const zclass_health = 3700 // health
const zclass_speed = 250 // speed
const Float:zclass_gravity = 0.80 // gravity
const Float:zclass_knockback = 1.5 // knockback
public plugin_init()
{
register_plugin("[ZP] Smoke Screen Zombie","1.0","Roadrage+KRoTaL")
register_clcmd("fart","fart")
register_cvar("amx_fart_wait","10")
register_cvar("amx_fart_ttl","180")
register_cvar("amx_fart_abuse","5")
register_event("ResetHUD","reset_hud","b")
register_logevent("endround", 2, "0=World triggered", "1=Round_End")
register_event("DeathMsg", "Death", "a", "3!0")
}
public Death()
{
new victim = read_data(2)
new headshot = read_data(3)
if( zp_get_user_zombie( victim ) && headshot )
if( zp_get_user_zombie_class( victim ) == g_zclass_gas )
client_cmd( victim, "mp3 play sound/Boom-Headshot.mp3" );
}
public plugin_precache()
{
g_zclass_gas = zp_register_zombie_class(zclass_name, zclass_info, zclass_model, zclass_clawmodel, zclass_health, zclass_speed, zclass_gravity, zclass_knockback)
precache_sound("fart.wav")
precache_sound("gasp1.wav")
precache_sound("gasp2.wav")
precache_generic("sound/Boom-Headshot.mp3")
fart_spr = precache_model("sprites/xsmoke1.spr")
}
// User Infected forward
public zp_user_infected_post(id, infector)
{
if (zp_get_user_zombie_class(id) == g_zclass_gas)
{
client_print(id,print_chat,"[ZP] You are using gas zombie bind key to fart to create smoke screen")
wait_damage[id] = true
}
}
public reset_hud(id)
{
wait_damage[id] = false
next_fart[id] = 0.0
farts_count[id] = 0
}
public endround()
{
set_task(3.0, "kill_farts", 99999944)
}
public fart(id)
{
if(!is_user_alive(id) || !zp_get_user_zombie(id))
return PLUGIN_HANDLED
if(zp_get_user_zombie_class(id) != g_zclass_gas)
return PLUGIN_CONTINUE
if(get_gametime() < next_fart[id])
{
new timetowait = floatround(next_fart[id]-get_gametime())
client_print(id, print_chat, "YOU HAVE TO WAIT %d SECOND%s BEFORE USING SMOKE SCREEN AGAIN!", timetowait, (timetowait>1)?"S":"")
}
else
{
emit_sound(id, CHAN_VOICE, "fart.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
new origin[3]
get_user_origin(id, origin)
for (new j = 0; j < 10; j++)
{
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
write_byte(101)
write_coord(origin[0])
write_coord(origin[1])
write_coord(origin[2] - 26)
write_coord(random_num(-100,100))
write_coord(random_num(-100,100))
write_coord(random_num(20,300))
write_byte(100)
write_byte(random_num(100,200))
message_end()
}
create_fart(id)
farts_count[id]++
if(farts_count[id] > get_cvar_num("amx_fart_abuse"))
{
new health = get_user_health(id) - random_num(10,50)
if(health > 0)
{
user_slap(id, health)
client_print(id, print_chat, "Do not abuse the power of smoke screen or you will pay the consequences!")
}
else
{
emit_sound(id, CHAN_VOICE, "fart.wav", 1.0, 0.2, 0, PITCH_NORM)
message_begin(MSG_ALL, SVC_TEMPENTITY)
write_byte(10)
write_coord(origin[0])
write_coord(origin[1])
write_coord(origin[2]-26)
message_end()
user_kill(id)
new player_name[32]
get_user_name(id, player_name, 31)
client_print(0, print_chat, "%s abused smoke screen and he blew up! ", player_name)
}
}
next_fart[id] = get_gametime() + get_cvar_float("amx_fart_wait")
}
return PLUGIN_HANDLED
}
public reset_damage(ids[])
{
wait_damage[ids[0]] = false
}
public create_fart(id)
{
new Floatrigin[3]
entity_get_vector(id, EV_VEC_origin, origin)
new FartEnt
FartEnt = create_entity("info_target")
if(FartEnt <= 0)
{
return PLUGIN_HANDLED_MAIN
}
entity_set_string(FartEnt, EV_SZ_classname, "hazardous fart")
new Float:MinBox[3]
new Float:MaxBox[3]
MinBox[0] = -80.0
MinBox[1] = -80.0
MinBox[2] = -80.0
MaxBox[0] = 80.0
MaxBox[1] = 80.0
MaxBox[2] = 80.0
entity_set_size(FartEnt, MinBox, MaxBox)
entity_set_int(FartEnt, EV_INT_solid, 1)
entity_set_edict(FartEnt, EV_ENT_owner, 33+id)
entity_set_origin(FartEnt, origin)
new param[1]
param[0]= FartEnt
set_task(1.0,"fart_fume",111111+FartEnt,param ,1,"b")
set_task(get_cvar_float("amx_fart_ttl"),"remo ve_fart",333333+FartEnt,param,1)
return PLUGIN_CONTINUE
}
public remove_fart(param[1])
{
new FartEnt = param[0]
if(is_valid_ent(FartEnt)) remove_entity(FartEnt)
remove_task(111111+FartEnt)
return PLUGIN_CONTINUE
}
public kill_farts()
{
new iEntity = find_ent_by_class(-1, "hazardous fart")
while(iEntity > 0)
{
remove_entity(iEntity)
remove_task(111111+iEntity)
remove_task(333333+iEntity)
iEntity = find_ent_by_class(-1, "hazardous fart")
}
return PLUGIN_CONTINUE
}
public fart_fume(param[1])
{
new FartEnt = param[0]
new Float:forigin[3], origin[3]
entity_get_vector(FartEnt, EV_VEC_origin, forigin)
FVecIVec(forigin, origin)
new players[32], inum
get_players(players,inum)
for(new i = 0 ;i < inum; ++i)
{
message_begin(MSG_ONE,SVC_TEMPENTITY,{0,0,0}, players[i])
write_byte(17)
write_coord(origin[0])
write_coord(origin[1])
write_coord(origin[2]+30)
write_short(fart_spr)
write_byte(180)
write_byte(100)
message_end()
}
return PLUGIN_CONTINUE
}
|
Your code did not contain any headshot death event, so I added that part :
Quote:
register_event("DeathMsg", "Death", "a", "3!0")
}
public Death()
{
new victim = read_data(2)
new headshot = read_data(3)
if( zp_get_user_zombie( victim ) && headshot )
if( zp_get_user_zombie_class( victim ) == g_zclass_gas )
client_cmd( victim, "mp3 play sound/Boom-Headshot.mp3" );
}
|
Also, I added the
Quote:
precache_generic("sound/Boom-Headshot.mp3")
|
part, as an .mp3 is considered a generic, for what I know,It should be working now, as it has the DeathMsg event.
Last edited by Kazalu; 12-28-2015 at 04:44.
|
|