AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How do I stop people from spamming a command (https://forums.alliedmods.net/showthread.php?t=57954)

awwhailnaw 07-15-2007 14:08

How do I stop people from spamming a command
 
Please and thank you

Lee 07-15-2007 14:46

Re: How do I stop people from spamming a command
 
What command(s) did you have in mind?

awwhailnaw 07-15-2007 15:18

Re: How do I stop people from spamming a command
 
i have a fartmod and you can keep doing it

Lee 07-15-2007 15:28

Re: How do I stop people from spamming a command
 
Post a link to the source.

awwhailnaw 07-15-2007 15:32

Re: How do I stop people from spamming a command
 
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")
}


Lee 07-15-2007 15:58

Re: How do I stop people from spamming a command
 
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.

awwhailnaw 07-15-2007 16:02

Re: How do I stop people from spamming a command
 
this is for tsrp so i just want it so you can only use it like once a min or something like that

Lee 07-15-2007 16:16

Re: How do I stop people from spamming a command
 
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") }

awwhailnaw 07-15-2007 17:43

Re: How do I stop people from spamming a command
 
Ok that worked thank you a lot


All times are GMT -4. The time now is 21:24.

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