Help please! - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help please! (
/showthread.php?tid=80264)
Help please! -
BigNewBie - 03.06.2009
I need an anti cmd spamming! Like the player can 3 times write that cmd not 1000 times!
can anybody help me?
Re: Help please! -
robanswe - 03.06.2009
Here is the link:
http://forum.sa-mp.com/index.php?topic=30726.0
Re: Help please! -
Think - 03.06.2009
simply use a variable and a timer.
pawn Код:
forward antispam(playerid);
public OnPlayerCommandText(playerid, cmdtext)
{
if(spam[playerid] >=3) {
SendClientMessage(playerid, RED, "Stop spamming wait 5 sec.");
SetTimerEx("antispam", 30000, false, "i", playerid);
}
if(strcmp("/help", cmdtext, true)==0)
{
spam[playerid]++;
}
return 0;
}
public antispam(playerid) {
spam[playerid] = 0;
SendClientMessage(playerid, RED,"you can now type a command");
return 1;
}
not test / compiled,
Re: Help please! -
Correlli - 03.06.2009
You forgot:
Re: Help please! -
Think - 03.06.2009
Quote:
Originally Posted by Don Correlli
|
stupid me :X
Re: Help please! -
BigNewBie - 03.06.2009
Quote:
Originally Posted by Pandabeer1337
simply use a variable and a timer.
pawn Код:
forward antispam(playerid);
public OnPlayerCommandText(playerid, cmdtext) { if(spam[playerid] >=3) { SendClientMessage(playerid, RED, "Stop spamming wait 5 sec."); SetTimerEx("antispam", 30000, false, "i", playerid); } if(strcmp("/help", cmdtext, true)==0) { spam[playerid]++; } return 0; }
public antispam(playerid) { spam[playerid] = 0; SendClientMessage(playerid, RED,"you can now type a command"); return 1; }
not test / compiled,
|
uhm,i don't fet this code very vell... do I need to ad every my commands under OnPlayerCommandText? like /help .Credits ..etc ?
Re: Help please! -
Think - 03.06.2009
unless you want it that you cant spam 3 different commands, than you could just do this:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext)
{
spam[playerid]++;
if(spam[playerid] >=3) {
SendClientMessage(playerid, RED, "Stop spamming wait 5 sec.");
SetTimerEx("antispam", 30000, false, "i", playerid);
}
return 0;
}
Re: Help please! -
BigNewBie - 03.06.2009
Quote:
Originally Posted by Pandabeer1337
unless you want it that you cant spam 3 different commands, than you could just do this:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext) { spam[playerid]++; if(spam[playerid] >=3) { SendClientMessage(playerid, RED, "Stop spamming wait 5 sec."); SetTimerEx("antispam", 30000, false, "i", playerid); } return 0; }
isn't this for anti chat spamming?
|
Re: Help please! -
Backwardsman97 - 03.06.2009
It would work the same for commands. But you should just put 'spam[playerid]++;' under each command instead of out in the open. It will work like that, but every time you type a random command or a wrong command, it will count towards spamming.
Re: Help please! -
BigNewBie - 03.06.2009
Quote:
Originally Posted by Backwardsman97
It would work the same for commands. But you should just put 'spam[playerid]++;' under each command instead of out in the open. It will work like that, but every time you type a random command or a wrong command, it will count towards spamming.
|
ok thank you..but do you have any other idea?