SA-MP Forums Archive
Anti-Command-Spam (+rep) - 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)
+--- Thread: Anti-Command-Spam (+rep) (/showthread.php?tid=328803)



Anti-Command-Spam (+rep) - Dripac - 26.03.2012

Hey, is it possible to apply a PVar to all server commands? Because i want that every command can be used only every 3 seconds by a player.


Re: Anti-Command-Spam (+rep) - Reklez - 26.03.2012

do you use strcmp or ZCMD


Re: Anti-Command-Spam (+rep) - Dripac - 26.03.2012

Quote:
Originally Posted by Reklez
Посмотреть сообщение
do you use strcmp or ZCMD
strcmp


Re: Anti-Command-Spam (+rep) - Reklez - 26.03.2012

pawn Код:
new SpamCheck[MAX_PLAYERS]; //add at the top of script

SpamCheck[playerid] = GetTickCount(); //add this in every command

    if(GetTickCount() - SpamCheck[playerid] < 3000 && SpamCheck[playerid] != 0) //put this onplayercommandtext - above
    {
        //put any code you want like SendClientMessage - You can use the command after 3 secs
        return false;
    }



Re: Anti-Command-Spam (+rep) - Dripac - 26.03.2012

I know that i can add it in every command, but i want it only one time, and it should affect every command


Re: Anti-Command-Spam (+rep) - Reklez - 26.03.2012

then put this onplayercommandtext above!

pawn Код:
if(GetTickCount() - SpamCheck[playerid] < 3000 && SpamCheck[playerid] != 0) //put this onplayercommandtext - above
    {
        //put any code you want like SendClientMessage - You can use the command after 3 secs
        return false;
    }

SpamCheck[playerid] = GetTickCount();



Re: Anti-Command-Spam (+rep) - Dripac - 26.03.2012

It works, but it also says SERVER; Unknown Command


Re: Anti-Command-Spam (+rep) - Reklez - 26.03.2012

change return false; to return 1;


Re: Anti-Command-Spam (+rep) - Dripac - 26.03.2012

Thanks, i would give you +rep now but i can't because i gave you recently
Post on my wall if you want so i will give you later


Re: Anti-Command-Spam (+rep) - Reklez - 26.03.2012

No Problem. i just want to help others