|
Senior Member
|

04-28-2009
, 22:31
Re: [ZP] Extra Class Smoke Screen Zombie
|
#9
|
Quote:
Originally Posted by tii
hey, there is a new version of KroTaL, where he reviewed some bugs and optimized the code.
if you can see ...
thx,
Code:
/************************************************** ************************************************** *********
AMX Hazardous Farts
Version: 0.1
Author: KRoTaL
0.1 Release
Players can fart with the "fart" command (type it in the game console or bind a key with it).
The fume of the fart is toxic and players will lose health points if they go inside.
You will get one frag if you kill a player with one of your farts.
Do not fart too much or you will lose health points.
Cvars:
amx_fart_wait 20 - time to wait between 2 farts in seconds
amx_fart_ttl 30 - time to live of the fume of a fart in seconds
amx_fart_dmg 10 - damage per second done to a player who is inside the fume
amx_fart_abuse 3 - number of times to fart after which a player will lose hp at each new fart
Setup:
Install the amx file.
Enable VexdUM.
Put these files on your server:
sound/hazardous_farts/hazardous_fart.wav
sound/hazardous_farts/gasp1.wav
sound/hazardous_farts/gasp2.wav
Ported to AMXX 1.76 by TatsuSaisei
* changed old code (entity_touch) to newer code (pfn_touch)
* changed MinBox and MaxBox from -80 to -40 and 80 to 40
* changed include from amxmod to amxmodx
* removed precache headshot sound file.... why was it precaching a sound it never used ??
* fixed voice channel issues
* allowed farter to avoid damage as long as they have 100 health
* tested 11/24/06 - 66.55.137.182:27015
************************************************** ************************************************** *********/
#include <amxmodx>
#include <fun>
#include <engine>
new Float:next_fart[33]
new farts_count[33]
new fart_spr
new bool:wait_damage[33]
public plugin_init()
{
register_plugin("Hazardous Farts","76.4","portby:TatsuSaisei")
register_clcmd("fart","fart")
register_cvar("amx_fart_wait","20")
register_cvar("amx_fart_ttl","30")
register_cvar("amx_fart_dmg","10")
register_cvar("amx_fart_abuse","3")
register_event("ResetHUD","reset_hud","b")
register_logevent("endround", 2, "0=World triggered", "1=Round_End")
}
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))
return PLUGIN_HANDLED
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 FARTING AGAIN!", timetowait, (timetowait>1)?"S":"")
}
else
{
emit_sound(id, CHAN_AUTO, "hazardous_farts/hazardous_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 farting or you will pay the consequences!")
}
else
{
emit_sound(id, CHAN_AUTO, "hazardous_farts/hazardous_fart.wav", 1.0, ATTN_NORM, 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 farted too hard and he blew up! Laugh at him!", player_name)
}
}
next_fart[id] = get_gametime() + get_cvar_float("amx_fart_wait")
}
return PLUGIN_HANDLED
}
public pfn_touch(entity1, entity2)
{
if(entity1 > 0 && is_valid_ent(entity1) && is_user_alive(entity2))
{
new fartClassName[32]
entity_get_string(entity1, EV_SZ_classname, fartClassName, 31)
if(equal(fartClassName,"hazardous_fart"))
{
if(!wait_damage[entity2])
{
new killer = entity_get_edict(entity1, EV_ENT_owner) - 33
extra_damage(killer, entity2)
wait_damage[entity2] = true
new ids[1]
ids[0] = entity2
set_task(1.0, "reset_damage", 555555+entity2, ids, 1)
}
}
}
return PLUGIN_CONTINUE
}
public extra_damage(killer, victim)
{
new Float:origin[3]
entity_get_vector(victim, EV_VEC_origin, origin)
if ((killer == victim && get_user_health(victim) == 100) || killer != victim)
{
fakedamage (victim, "hazardous fart", get_cvar_float("amx_fart_dmg"), DMG_POISON )
if(is_user_alive(victim))
{
switch(random_num(0,1)){
case 0: emit_sound(victim, CHAN_AUTO, "hazardous_farts/gasp1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
case 1: emit_sound(victim, CHAN_AUTO, "hazardous_farts/gasp2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
}
}
else
{
new kname[32], vname[32]
get_user_name(killer, kname, 31)
get_user_name(victim, vname, 31)
if(killer == victim)
{
client_print(0, print_chat, "OMG! %s killed himself with one of his hazardous farts! Shame on him, HaHaHaHa!", kname)
}
else
{
client_print(0, print_chat, "OMG! %s killed %s with one of his hazardous farts! Shame on %s, HaHaHaHa!", kname, vname, vname)
}
if(get_user_team(killer) == get_user_team(victim))
{
set_user_frags(killer, get_user_frags(killer) - 2)
}
}
}
return PLUGIN_CONTINUE
}
public reset_damage(ids[])
{
wait_damage[ids[0]] = false
}
public create_fart(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] = -40.0
MinBox[1] = -40.0
MinBox[2] = -40.0
MaxBox[0] = 40.0
MaxBox[1] = 40.0
MaxBox[2] = 40.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"),"remove_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},playe rs[i])
write_byte(17)
write_coord(origin[0])
write_coord(origin[1])
write_coord(origin[2])
write_short(fart_spr)
write_byte(30)
write_byte(75)
message_end()
}
return PLUGIN_CONTINUE
}
public plugin_precache()
{
precache_sound("hazardous_farts/hazardous_fart.wav")
precache_sound("hazardous_farts/gasp1.wav")
precache_sound("hazardous_farts/gasp2.wav")
fart_spr = precache_model("sprites/poison.spr")
}
|
Yup, that was the original code
|
|