| Mr.Noobie |
06-03-2009 08:33 |
Smoke Grenade.
1 Attachment(s)
Can anyone provide me smoke nade codes ?
Because my smoke nade look really big smoke.
I want just the normal smoke.
Code:
Code:
/*================================================================================
-----------------------------------
-*- [ZP] Class : Smoke Screen Zombie -*-
-----------------------------------
~~~~~~~~~~~~~~~
- Description -
~~~~~~~~~~~~~~~
Able to use black smoke.
================================================================================*/
#include <amxmodx>
#include <zombieplague>
#include <engine>
new g_zclass_sszombie
new smoke_spr
new Float:g_cooldown[33]
new smoke_count[33]
new bool:wait_damage[33]
new cvar_bind
new const zclass_name[] = { "Smoke Screen Zombie" }
new const zclass_info[] = { "Smoke Screen" }
new const zclass_model[] = { "zombie_source3" }
new const zclass_clawmodel[] = { "v_knife_zombie.mdl" }
const zclass_health = 1500
const zclass_speed = 250
const Float:zclass_gravity = 1.0
const Float:zclass_knockback = 1.0
public plugin_init()
{
register_plugin("[ZP] Class : Smoke Screen Zombie", "1.0", "zombie")
register_event("ResetHUD","reset_hud","b")
register_logevent("endround", 2, "0=World triggered", "1=Round_End")
register_clcmd("+smoke","smoke", ADMIN_USER, "bind ^"key^" ^"+drag^"")
register_cvar("zp_sszombie_cooldown","30")
register_cvar("zp_sszombie_ttl","180")
register_cvar("zp_sszombie_abuse","5")
cvar_bind = register_cvar("zp_sszombie_bind", "1")
}
public plugin_precache()
{
g_zclass_sszombie = zp_register_zombie_class(zclass_name, zclass_info, zclass_model, zclass_clawmodel, zclass_health, zclass_speed, zclass_gravity, zclass_knockback)
precache_sound("player/headshot1.wav")
smoke_spr = precache_model("sprites/smoke.spr")
precache_sound("sg_explode.wav")
}
public zp_user_infected_post(id, infector)
{
if (zp_get_user_zombie_class(id) == g_zclass_sszombie)
{
wait_damage[id] = true
new mode = get_pcvar_num(cvar_bind)
if (mode == 1) {
client_cmd(id, "bind v ^"+smoke^"")
client_print(id, print_chat, "[ZP] To use Smoke Screen press ^'^'V^'^'")
}
if (mode == 0) {
client_print(id, print_chat, "[ZP] To use Smoke Screen (bind ^'^'key^'^' ^'^'+smoke^'^') hold binded key")
}
}
}
public reset_hud(id)
{
g_cooldown[id] = 0.0
smoke_count[id] = 0
wait_damage[id] = false
}
public endround()
{
set_task(3.0, "kill_smoke", 99999944)
}
public smoke(id)
{
if (!is_user_alive(id) || !zp_get_user_zombie(id))
return PLUGIN_HANDLED
if (zp_get_user_zombie_class(id) != g_zclass_sszombie)
return PLUGIN_CONTINUE
if(get_gametime() < g_cooldown[id])
{
new timetowait = floatround(g_cooldown[id]-get_gametime())
client_print(id, print_chat, "wait for %d second%s before using Smoke Screen again.", timetowait, (timetowait>1)?"S":"")
}
else
{
emit_sound(id, CHAN_VOICE, "sg_explode.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_smoke(id)
smoke_count[id]++
if(smoke_count[id] > get_cvar_num("zp_sszombie_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 Smoke Screen or you will have to face the consequences.")
}
else
{
emit_sound(id, CHAN_VOICE, "sg_explode.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 abuse Smoke Screen and he blew up.", player_name)
}
}
g_cooldown[id] = get_gametime() + get_cvar_float("zp_sszombie_cooldown")
}
return PLUGIN_HANDLED
}
public reset_damage(ids[])
{
wait_damage[ids[0]] = false
}
public create_smoke(id)
{
new Float:origin[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,"smoke_fume",111111+FartEnt,param,1,"b")
set_task(get_cvar_float("zp_sszombie_ttl"),"remove_smoke",333333+FartEnt,param,1)
return PLUGIN_CONTINUE
}
public remove_smoke(param[1])
{
new FartEnt = param[0]
if(is_valid_ent(FartEnt)) remove_entity(FartEnt)
remove_task(111111+FartEnt)
return PLUGIN_CONTINUE
}
public kill_smoke()
{
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 smoke_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(smoke_spr)
write_byte(180)
write_byte(100)
message_end()
}
return PLUGIN_CONTINUE
}
If the file you can't understand here the SMA.
|