SA-MP Forums Archive
[Help]Anti Spam,timers,etc. - 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: [Help]Anti Spam,timers,etc. (/showthread.php?tid=485937)



[Help]Anti Spam,timers,etc. - ADZAA - 06.01.2014

I made Anti Spam for my server in public OnPlayerText and it's work but if player do spam,server warn him.I want to make a timer when he makes a spam,timer stop him writting for 60 seconds,how I make this?


Re: [Help]Anti Spam,timers,etc. - Patrick - 06.01.2014

Explanation inside.
pawn Код:
public OnPlayerText(playerid, text[])
{
    new StartTextTick;

    if(gettime() - StartTextTick > 1) //if the StartTextTick is more than 60 seconds it will show him the message.
        return SendClientMessage(playerid, -1, "Please wait 60 seconds to send a text again, thank you!");

    StartTextTick = gettime()+60; //get the current time + 60 seconds
    return true; //return false if you have your style of sending the message.
}