Raised This Month: $ Target: $400
 0% 

Simple plugin help.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
dongfatt
Member
Join Date: Aug 2005
Old 11-17-2006 , 16:56   Simple plugin help.
Reply With Quote #1

[code]
#include <amxmodx>
#include <fun>

new bool:fart[33]

public plugin_init()
{
register_plugin(Sound, 1.00, Mike)
register_clcmd("say /fart","Fart")
}

public plugin_precache()
{
precache_sound("fart.wav")
}

public client_connect(id)
{
fart[id]=false
}

public client_disconnect(id)
{
fart[id]=false
}

public fart(id)
{
if(!fart[id])
{
client_print(id,print_chat,"You Have Just Farted."
}
else
{
fart[id]=false
}
return PLUGIN_HANDLED

I do not know what else i have to do in order to make it so that every time a player dies it makes a fart sound, this plugin is for learning how to become a better coder. Thank in advance.

Last edited by dongfatt; 11-17-2006 at 16:59.
dongfatt is offline
Da_sk8rboy
Veteran Member
Join Date: Jul 2006
Old 11-17-2006 , 17:02   Re: Simple plugin help.
Reply With Quote #2

please you small:

Code:
 #include <amxmodx> #include <fun> new bool:fart[33] public plugin_init() {     register_plugin(Sound, 1.00, Mike)     register_clcmd("say /fart","Fart") } public plugin_precache() {     precache_sound("fart.wav") } public client_connect(id) {     fart[id]=false } public client_disconnect(id) {     fart[id]=false } public fart(id) {     if(!fart[id])     {         client_print(id,print_chat,"You Have Just Farted."     }     else     {         fart[id]=false     }     return PLUGIN_HANDLED
__________________
i stop around here and there.
Da_sk8rboy is offline
The Specialist
BANNED
Join Date: Nov 2006
Old 11-17-2006 , 17:04   Re: Simple plugin help.
Reply With Quote #3

you need a death message to find out when the player dies then play the sound in the hooked message. you also dont need to do a client connect or disconenct. its not necesary. alot of un-needed code .
The Specialist is offline
Send a message via AIM to The Specialist
Old 11-17-2006, 17:13
Da_sk8rboy
This message has been deleted by Da_sk8rboy.
dongfatt
Member
Join Date: Aug 2005
Old 11-17-2006 , 17:20   Re: Simple plugin help.
Reply With Quote #4

thanks for the reply but i need help with the whole plugin since i put alot of unnecessary stuff in there i don't know how to fix it.

Last edited by dongfatt; 11-17-2006 at 17:23.
dongfatt is offline
Old 11-17-2006, 17:37
Da_sk8rboy
This message has been deleted by Da_sk8rboy.
dongfatt
Member
Join Date: Aug 2005
Old 11-17-2006 , 17:50   Re: Simple plugin help.
Reply With Quote #5

thanks for your reply.
dongfatt is offline
Old 11-17-2006, 17:50
Da_sk8rboy
This message has been deleted by Da_sk8rboy.
Da_sk8rboy
Veteran Member
Join Date: Jul 2006
Old 11-17-2006 , 17:53   Re: Simple plugin help.
Reply With Quote #6

Code:
public plugin_precache() {         precache_sound("myfolder/mysound.wav")         // = modfolder/sound/myfolder/mysound.wav         // Note that some Sounds are precached by the Game already }   public something(id) {         emit_sound(id,4,"myfolder/mysound.wav",0.7,0.8,0,100)         // Will play a Sound at the Origin of the Player with given ID. Use id 0 to play to everyone               // OR         client_cmd("play myfolder/mysound.wav")         // Plays a Sound that only this client can hear.         // You can use id 0 here, too, which is better than emit_sound with id 0, because this will have Mono effect. }
__________________
i stop around here and there.
Da_sk8rboy is offline
dutchmeat
Senior Member
Join Date: Sep 2006
Old 11-20-2006 , 03:46   Re: Simple plugin help.
Reply With Quote #7

Code:
#include <amxmodx> #include <fun> new bool:fart[33] public plugin_init() {     register_plugin("FartMode", 1.00, "Mike")     register_clcmd("say /fart","Fart")     register_message(get_user_msgid("DeathMsg"), "deathmessage") } public plugin_precache() {     precache_sound("fart.wav") } public client_connect(id) {     fart[id]=false } public client_disconnect(id) {     fart[id]=false } public fart(id) {     if(!fart[id])     {         client_print(id,print_chat,"FartingMode is On."     }     else     {         fart[id]=false              client_print(id,print_chat,"FartingMode is Off."     }     return PLUGIN_HANDLED } public deathmessage(msg_id, msg_dest, msg_entity){ //new killer = get_msg_arg_int(1) this is the killer,but we won't need it. new victim = get_msg_arg_int(2) //the victim, we need this. if (victim != -1 && fart[victim]){ //prevent a certain crash, wich happens when this message is called 3 times(one with the true victim id, and others are -1). //fart[victim] is a check if the 'farting mode' is enabled. emit_sound(victim,CHAN_BODY, "fart.wav", 1.0, ATTN_NORM, 0, PITCH_NORM) //fart! //fart[victim] = 0 this way you can disable the fartingmode at death, but you'll have to enable the mode each time. }

Last edited by dutchmeat; 11-20-2006 at 06:23.
dutchmeat is offline
SSJ2GOKU
Senior Member
Join Date: Oct 2005
Location: Belgium
Old 11-20-2006 , 04:47   Re: Simple plugin help.
Reply With Quote #8

made it more readable + corrected an error on the end of the plugin

Code:
#include <amxmodx> #include <fun> new bool:fart[33] public plugin_init() {     register_plugin("FartMode", 1.00, "Mike")     register_clcmd("say /fart","Fart")     register_message(get_user_msgid("DeathMsg"), "deathmessage") } public plugin_precache() {     precache_sound("fart.wav") } public client_connect(id) {     fart[id]=false } public client_disconnect(id) {     fart[id]=false } public fart(id) {     if(!fart[id])     {         client_print(id,print_chat,"FartingMode is On."     }     else     {         fart[id]=false         client_print(id,print_chat,"FartingMode is Off."     }     return PLUGIN_HANDLED } public deathmessage(msg_id, msg_dest, msg_entity){     new victim = get_msg_arg_int(2)     if (victim != -1 && fart[victim]){         emit_sound(victim,CHAN_BODY, "fart.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)     } }
SSJ2GOKU is offline
Send a message via MSN to SSJ2GOKU
dutchmeat
Senior Member
Join Date: Sep 2006
Old 11-20-2006 , 05:43   Re: Simple plugin help.
Reply With Quote #9

you added a last branch, and removed all my comment quotes?
__________________
before you criticize someone, you should walk a mile in their shoes. that way, when you criticize them, you're a mile away and you have their shoes.

Last edited by dutchmeat; 11-20-2006 at 06:30.
dutchmeat is offline
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 11-20-2006 , 12:22   Re: Simple plugin help.
Reply With Quote #10

better?
Code:
#include <amxmodx> new bool:fart[33] public plugin_init() {     register_plugin("FartMode", "1.00", "Mike")     register_clcmd("say /fart","cmd_fart")     register_event("DeathMsg", "deathmessage", "a") } public plugin_precache()     precache_sound("fart.wav") public client_connect(id)     fart[id] = false public client_disconnect(id)     fart[id] = false public cmd_fart(id) {     if ( ! fart[id] )         client_print(id,print_chat,"FartingMode is On.")         else {         fart[id] = false         client_print(id,print_chat,"FartingMode is Off.")     }         return PLUGIN_HANDLED } public event_DeathMsg() {         new victim = read_data(2)         if ( victim != -1 && fart[victim] )         emit_sound(victim, CHAN_BODY, "fart.wav", 1.0, ATTN_NORM, 0, PITCH_NORM) }
[ --<-@ ] Black Rose is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:59.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode