Raised This Month: $ Target: $400
 0% 

How do I stop people from spamming a command


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
awwhailnaw
Member
Join Date: Jul 2007
Old 07-15-2007 , 14:08   How do I stop people from spamming a command
Reply With Quote #1

Please and thank you
awwhailnaw is offline
Lee
AlliedModders Donor
Join Date: Feb 2006
Old 07-15-2007 , 14:46   Re: How do I stop people from spamming a command
Reply With Quote #2

What command(s) did you have in mind?
Lee is offline
awwhailnaw
Member
Join Date: Jul 2007
Old 07-15-2007 , 15:18   Re: How do I stop people from spamming a command
Reply With Quote #3

i have a fartmod and you can keep doing it
awwhailnaw is offline
Lee
AlliedModders Donor
Join Date: Feb 2006
Old 07-15-2007 , 15:28   Re: How do I stop people from spamming a command
Reply With Quote #4

Post a link to the source.
Lee is offline
awwhailnaw
Member
Join Date: Jul 2007
Old 07-15-2007 , 15:32   Re: How do I stop people from spamming a command
Reply With Quote #5

i dont have the source uploaded so ill just put the code here.
Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fun>

#define PLUGIN "FartMod"
#define VERSION "1.0"
#define AUTHOR "Alex gomez"


public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_clcmd("say /fart","fart")
    register_clcmd("say /burp","burp")
}
public overhear(a,distance,Speech[])
{
    
    new OriginA[3], OriginB[3]
    get_user_origin(a,OriginA)
    new players[32], num
    get_players(players,num,"ac")
    for(new b = 0; b < num;b++)
    {
    if(a!=players[b])
    {
         get_user_origin(players[b],OriginB)
         if(distance == -1) {
         client_print(players[b],print_chat,Speech)
         }
         else
         {
            if(get_distance(OriginA,OriginB) <= distance) {
               client_print(players[b],print_chat,Speech)
            }
         }
      }
   }
   return PLUGIN_HANDLED
}
public fart(id,entid) {
    new name[64]
    get_user_name(id,name,63)
    emit_sound(id, CHAN_STREAM, "fartmod/fart1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
    client_print(id, print_chat, "[FartMod] You ripped humungo ass on someone!")
    new message[300]
    format(message,299,"[FartMod] %s has ripped humungo ass on you!.",name)
    overhear(id,300,message)
    return PLUGIN_HANDLED
}
public burp(id,entid) {
    new name[64]
    get_user_name(id,name,63)
    emit_sound(id, CHAN_STREAM, "fartmod/burp1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
    client_print(id, print_chat, "[BurpMod] You let out a burp from hell!")
    new message[300]
    format(message,299,"[FartMod] %s burped on you!.",name)
    overhear(id,300,message)
    return PLUGIN_HANDLED
}
public plugin_precache() 
{
    precache_sound("fartmod/fart1.wav")
    precache_sound("fartmod/burp1.wav")
}
awwhailnaw is offline
Lee
AlliedModders Donor
Join Date: Feb 2006
Old 07-15-2007 , 15:58   Re: How do I stop people from spamming a command
Reply With Quote #6

This will allow a player to use each command once per round and won't show any sort of message explaining why the command doesn't work more often. It's not a problem if you'd like me to change that. The code already written could do with being cleaned up too.

Last edited by Lee; 07-15-2007 at 16:18.
Lee is offline
awwhailnaw
Member
Join Date: Jul 2007
Old 07-15-2007 , 16:02   Re: How do I stop people from spamming a command
Reply With Quote #7

this is for tsrp so i just want it so you can only use it like once a min or something like that
awwhailnaw is offline
Lee
AlliedModders Donor
Join Date: Feb 2006
Old 07-15-2007 , 16:16   Re: How do I stop people from spamming a command
Reply With Quote #8

Code:
#include <amxmodx> #include <amxmisc> #include <engine> #include <fun> #define PLUGIN "FartMod" #define VERSION "1.0" #define AUTHOR "Alex gomez" new lastFart[33], lastBurp[33] public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_clcmd("say /fart","fart")     register_clcmd("say /burp","burp") } public overhear(a,distance,Speech[]) {         new OriginA[3], OriginB[3]     get_user_origin(a,OriginA)     new players[32], num     get_players(players,num,"ac")     for(new b = 0; b < num;b++)     {         if(a!=players[b])         {             get_user_origin(players[b],OriginB)             if(distance == -1)             {                 client_print(players[b],print_chat,Speech)             }             else             {                 if(get_distance(OriginA,OriginB) <= distance)                 {                     client_print(players[b],print_chat,Speech)                 }             }         }     }     return PLUGIN_HANDLED } public fart(id) {     new currentTime = get_systime()     if(lastFart[id] + 60 > currentTime)     {         return PLUGIN_HANDLED     }         lastFart[id] = currentTime         new name[64]     get_user_name(id,name,63)     emit_sound(id, CHAN_STREAM, "fartmod/fart1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)     client_print(id, print_chat, "[FartMod] You ripped humungo ass on someone!")     new message[300]     format(message,299,"[FartMod] %s has ripped humungo ass on you!.",name)     overhear(id,300,message)         return PLUGIN_HANDLED } public burp(id) {     new currentTime = get_systime()     if(lastBurp[id] + 60 > currentTime)     {         return PLUGIN_HANDLED     }         lastBurp[id] = currentTime         new name[64]     get_user_name(id,name,63)     emit_sound(id, CHAN_STREAM, "fartmod/burp1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)     client_print(id, print_chat, "[BurpMod] You let out a burp from hell!")     new message[300]     format(message,299,"[FartMod] %s burped on you!.",name)     overhear(id,300,message)         return PLUGIN_HANDLED } public plugin_precache() {     precache_sound("fartmod/fart1.wav")     precache_sound("fartmod/burp1.wav") }
Lee is offline
awwhailnaw
Member
Join Date: Jul 2007
Old 07-15-2007 , 17:43   Re: How do I stop people from spamming a command
Reply With Quote #9

Ok that worked thank you a lot
awwhailnaw 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 21:24.


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