View Full Version : Hazardous Farts
ruffusbebad
11-19-2006, 09:42 AM
Has anyone got this, that will work with DoD/amxx. I got a amx version but can't
get it to work.
=|[76AD]|= TatsuSaisei
11-19-2006, 11:30 AM
Has anyone got this, that will work with DoD/amxx. I got a amx version but can't
get it to work.
provide the link to the original plugin you found so everyone who might decide to look at it doesnt have to go searching then hope they have the version you were originally interested in...
ruffusbebad
11-19-2006, 11:51 AM
http://djeyl.net/forum/index.php?showtopic=39917 This is the one I found, Thanks for any help in advance.
=|[76AD]|= TatsuSaisei
11-19-2006, 06:52 PM
http://djeyl.net/forum/index.php?showtopic=39917 This is the one I found, Thanks for any help in advance.
Try this code... I just took the code and changed outdated stuff. I did NOT test the plugin to see if it works, and if you DO use it you will need to download the sounds and stuff from the original plugin.
/************************************************** ************************************************** *********
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
************************************************** ************************************************** *********/
#include <amxmodx>
#include <fun>
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.1","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_VOICE, "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_VOICE, "hazardous_farts/hazardous_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 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 entity_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)
fakedamage (victim, "hazardous fart", get_cvar_float("amx_fart_dmg"), DMG_ACID )
if(is_user_alive(victim))
{
switch(random_num(0,1))
{
case 0: emit_sound(victim, CHAN_BODY, "hazardous_farts/gasp1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
case 1: emit_sound(victim, CHAN_BODY, "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] = -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"),"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")
precache_sound("player/headshot1.wav")
fart_spr = precache_model("sprites/poison.spr")
}
=|[76AD]|= TatsuSaisei
11-19-2006, 06:54 PM
ok I made a post with some code, but it seems I need "permission" to post it.. so when it gets "approved" it will show up, otherwise if it does not in the next few days I will simply PM you the code to try out...
diamond-optic
11-19-2006, 07:01 PM
|= TatsuSaisei;2302']ok I made a post with some code, but it seems I need "permission" to post it.. so when it gets "approved" it will show up, otherwise if it does not in the next few days I will simply PM you the code to try out...
im not exactly sure why it did that..
in the admin panel under posts awaiting moderation.. there was 3 posts... and one of them was by me.. and it didnt include any code brackets or anything.. not sure why it needed moderation.. but i forwarded the problem to zor
Your plugin failed to compile! Read the errors below:
Welcome to the AMX Mod X 1.76-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team
/home/groups/amxmodx/compiler3/include/engine_stocks.inc(27) : error 017: undefined symbol "DispatchKeyValue"
/home/groups/amxmodx/compiler3/include/engine_stocks.inc(32) : error 017: undefined symbol "DispatchKeyValue"
/home/groups/amxmodx/compiler3/include/engine_stocks.inc(34) : error 017: undefined symbol "DispatchKeyValue"
/home/groups/amxmodx/compiler3/include/engine_stocks.inc(35) : error 017: undefined symbol "DispatchKeyValue"
4 Errors.
Could not locate output file /home/groups/amxmodx/public_html/websc3/textEO4GBK.amx (compile failed).
Thats what I get trying to compile what you have.. :confused:
=|[76AD]|= TatsuSaisei
11-21-2006, 04:50 AM
OK, I the issue was found that prevented the online compiler from doing its thing. Thanx Raggy!
I went through the code and cleaned a few things up. I actually tested it this time and it works on my server now.
/************************************************** ************************************************** *********
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
* tested 11/21/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.2","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_VOICE, "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_VOICE, "hazardous_farts/hazardous_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 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)
fakedamage (victim, "hazardous fart", get_cvar_float("amx_fart_dmg"), DMG_ACID )
if(is_user_alive(victim))
{
switch(random_num(0,1)){
case 0: emit_sound(victim, CHAN_BODY, "hazardous_farts/gasp1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
case 1: emit_sound(victim, CHAN_BODY, "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")
precache_sound("player/headshot1.wav")
fart_spr = precache_model("sprites/poison.spr")
}
{SR} *Raggy*
11-21-2006, 04:14 PM
|= TatsuSaisei;2327']
#include <amxmod>
#include <fun>
#include <engine>
Is that supposed to be amxmodx?
=|[76AD]|= TatsuSaisei
11-21-2006, 05:42 PM
Is that supposed to be amxmodx?
yes, and is what caused the online compiler to choke, im kind of upset my local compiler did not point that out, but even with the incorrect spelling it does work as a plugin. I edited my posts to fix that... good catch
ruffusbebad
11-23-2006, 07:19 PM
I finally got to install this in my server. Everything works but the fart sound, Player immediatly starts gasping. Fart wav is in proper place and wmp plays it when I click on it. I really appreciate your work. Hopefully it is something simple. thanks again
=|[76AD]|= TatsuSaisei
11-23-2006, 08:51 PM
I finally got to install this in my server. Everything works but the fart sound, Player immediatly starts gasping. Fart wav is in proper place and wmp plays it when I click on it. I really appreciate your work. Hopefully it is something simple. thanks again
You know, I noticed that it only played about half the time as well... but, to be honest, I think it IS playing and you would hear it, if you could fart and get away fast enough to avoid initial damage, but when you fart you are immediately damaged and begin to "choke"... have you tried having someone else "listen" for the fart ?
ruffusbebad
11-23-2006, 09:03 PM
Yes, several times before I made the post. Never heard the fart.
diamond-optic
11-23-2006, 09:08 PM
well maybe try a different channel instead of voice so that a new sound doesnt cancel it out
ruffusbebad
11-23-2006, 09:13 PM
How do I do that?
=|[76AD]|= TatsuSaisei
11-24-2006, 04:41 AM
well maybe try a different channel instead of voice so that a new sound doesnt cancel it out
to be fair.. I did not "write" the code but simply ported it from amx to amxx...
and after further investigation of the code it IS using 2 seperate channels for the "fart" (chan_voice) and for the "gasps" (chan_body) .... honestly I think they should be reversed... the fart coming from the body and the gasps from voice... makes more sense, but in any event they are playing on seperate channels now... therefore something else needs to be done... like stopping the initial damage caused by farting itself, or atleast removing the initial gasp.. maybe put the gasping on a timer... 3 seconds after inhalation maybe.. lol that would allow the fart to be heard... also maybe I will look into a different sprite for the cloud.. a partially visible white cloud just does not look "menacing" enough .. lmao
=|[76AD]|= TatsuSaisei
11-24-2006, 09:04 AM
|= TatsuSaisei;2368']to be fair.. I did not "write" the code but simply ported it from amx to amxx...
and after further investigation of the code it IS using 2 seperate channels for the "fart" (chan_voice) and for the "gasps" (chan_body) .... honestly I think they should be reversed... the fart coming from the body and the gasps from voice... makes more sense, but in any event they are playing on seperate channels now... therefore something else needs to be done... like stopping the initial damage caused by farting itself, or atleast removing the initial gasp.. maybe put the gasping on a timer... 3 seconds after inhalation maybe.. lol that would allow the fart to be heard... also maybe I will look into a different sprite for the cloud.. a partially visible white cloud just does not look "menacing" enough .. lmao
* fixed voice channel issues
* allowed farter to avoid damage as long as they have 100 health
/************************************************** ************************************************** *********
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")
}
ruffusbebad
11-24-2006, 10:06 AM
I couldn't get this one to compile;Your plugin failed to compile! Read the errors below:
Welcome to the AMX Mod X 1.76-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team
/home/groups/amxmodx/tmp3/php0nyt07.sma(252) : error 001: expected token: "}", but found "-end of file-"
1 Error.
Could not locate output file /home/groups/amxmodx/public_html/websc3/php0nyt07.amx (compile failed).
132481 successful compiles to date.
72933 failed compiles to date.
Old compiler: 101980 compiles before decommission.
This tool by: David "BAILOPAN" Anderson.
=|[76AD]|= TatsuSaisei
11-24-2006, 10:13 AM
I couldn't get this one to compile;Your plugin failed to compile! Read the errors below:
Welcome to the AMX Mod X 1.76-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team
/home/groups/amxmodx/tmp3/php0nyt07.sma(252) : error 001: expected token: "}", but found "-end of file-"
1 Error.
Could not locate output file /home/groups/amxmodx/public_html/websc3/php0nyt07.amx (compile failed).
132481 successful compiles to date.
72933 failed compiles to date.
Old compiler: 101980 compiles before decommission.
This tool by: David "BAILOPAN" Anderson.
You did not grab all of the text in the code block... I grabbed it all and tried it in the online compiler and it works fine... you "missed" the last braces }
http://customdod.com/amxx_plugins/amx_fart.sma
ruffusbebad
11-24-2006, 10:47 AM
Got it, thanks a ton. I hear the fart now. Only thing is I still gasp once, would be better if fart was only sound while farting. This works tho. I looked at the code.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) Is this where one would change? I have no idea, just guessing.
=|[76AD]|= TatsuSaisei
11-24-2006, 04:18 PM
Got it, thanks a ton. I hear the fart now. Only thing is I still gasp once, would be better if fart was only sound while farting. This works tho. I looked at the code.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) Is this where one would change? I have no idea, just guessing.
Those 2 lines are the code to play one of the 2 seperate sounds... There is some code right before those that establishes a random number from 0 to 1 and then based on which number it picks plays one or the other gasp sound... be happy it plays the gasp sound at all and trust me when I say you do not want it to be playing over and over... the issue now is that 2 other sounds are now competing to play... the short of breath sound for losing stamina (which happens as you are damaged) and the sound for the "damage" that occurs... in any event sounds are playing while you are being damaged... the initial fart sound plays which is the most "important" feature of the plugin besides the gas effect...
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.