Need help, lol - 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: Need help, lol (
/showthread.php?tid=274630)
Need help, lol -
Nenad - 06.08.2011
Can someone help me how to create anti-command and anti-chat (anti-flood) spam using gettime(); function
(because SetTimer create lag)
Re: Need help, lol -
Tigerkiller - 06.08.2011
use SetTimerEx
Re: Need help, lol -
Nenad - 06.08.2011
Quote:
Originally Posted by Tigerkiller
use SetTimerEx
|
It will create lag same as SetTimer.
Re: Need help, lol -
=WoR=Varth - 06.08.2011
pawn Код:
new Spam[MAX_PLAYERS];//On top of your script
//Inside your command
if((GetTickCount() - Spam[playerid]) < 3000) return SendClientMessage(playerid,Rage_Red,"SPAMMER GTFO!");
Spam[playerid] = GetTickCount();
Re: Need help, lol -
Nenad - 06.08.2011
Quote:
Originally Posted by varthshenon
pawn Код:
new Spam[MAX_PLAYERS];//On top of your script
//Inside your command if((GetTickCount() - Spam[playerid]) < 3000) return SendClientMessage(playerid,Rage_Red,"SPAMMER GTFO!"); Spam[playerid] = GetTickCount();
|
Thanks, you get +1 reputation from me, lol.
So in basic it is same as
pawn Код:
new Spam[MAX_PLAYERS];//On top
//Inside your command
if((gettime() - Spam[playerid]) < 3) return SendClientMessage(playerid,-1,"You are spamming!");
Spam[playerid] = gettime();
(I use gettime() because I think it is faster and doesn't create lag)
but do I need to put it in all my commands or there is faster way of doing this?
Re: Need help, lol -
=WoR=Varth - 06.08.2011
What command processor do you use?
Re: Need help, lol -
Nenad - 06.08.2011
ZCMD and strcmp (soon all commands will be in ZCMD)
Re: Need help, lol -
=WoR=Varth - 06.08.2011
AFAIK you can't use "OnPlayerCommandText" if you use ZCMD.
For ZCMD:
pawn Код:
new Spam[MAX_PLAYERS];
public OnPlayerCommandReceived(playerid,cmdtext[])
{
if((gettime() - Spam[playerid]) < 3)
{
SendClientMessage(playerid,-1,"You are spamming!");
return 0;
}
Spam[playerid] = gettime();
return 1;
}
Re: Need help, lol -
Nenad - 06.08.2011
Thanks, it works perfect
Re: Need help, lol -
KoczkaHUN - 06.08.2011
Check this out, may help
Re: Need help, lol -
Nenad - 06.08.2011
Quote:
Originally Posted by KoczkaHUN
|
Thanks, but I like it more using gettime() function and it is faster