Anti-Command-Spam (+rep)
#1

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.
Reply
#2

do you use strcmp or ZCMD
Reply
#3

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

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;
    }
Reply
#5

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

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();
Reply
#7

It works, but it also says SERVER; Unknown Command
Reply
#8

change return false; to return 1;
Reply
#9

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
Reply
#10

No Problem. i just want to help others
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)