SA-MP Forums Archive
Spamming Adminwarn for Anti-Cheat - 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: Spamming Adminwarn for Anti-Cheat (/showthread.php?tid=594657)



Spamming Adminwarn for Anti-Cheat - Japanda - 21.11.2015

Hi.

i have this code to broadcast the anticheat warn to admins

Код HTML:
OnCheat(playerid, type, code)
{
								new name[MAX_PLAYER_NAME], string[24+MAX_PLAYER_NAME];
								GetPlayerName(playerid, name, sizeof(name));
                                format(string, 256, "Server detected %s on %s(%i).", Cheatsa[code], name, playerid);
                                ABroadCast(-1,string,1);
}
And this code is spamming like this:

in 1 second:
Server detected SpeedHack on Japanda(0).
Server detected SpeedHack on Japanda(0).
Server detected SpeedHack on Japanda(0).
Server detected SpeedHack on Japanda(0).
Server detected SpeedHack on Japanda(0).
Server detected SpeedHack on Japanda(0).

Any idea?

Sry for my bad english.


Re: Spamming Adminwarn for Anti-Cheat - Japanda - 21.11.2015

there is not any way?


Re: Spamming Adminwarn for Anti-Cheat - iKarim - 21.11.2015

Does your anticheat runs in OnPlayerUpdate? If yes I recommend you to make 3 second global timer and loop players to check for cheats.
or you can use this:
PHP код:
#define SEND_DELAY_TIME 5000   // Edit this to meet your needs; although it shouldn't be lower than 1000.
new
    
LastTickCount[MAX_PLAYERS] = {0,...}; // In your script near other variables under defines
OnCheat(playeridtypecode)
{
    if(
LastTickCount[MAX_PLAYERS] < GetTickCount()) // Checks if 5 seconds are passed
    
{
        
LastTickCount[MAX_PLAYERS] = GetTickCount() + SEND_DELAY_TIME// Sets the LastTick to current Tick.
        
new name[MAX_PLAYER_NAME], string[24+MAX_PLAYER_NAME];
        
GetPlayerName(playeridnamesizeof(name));
        
format(string256"Server detected %s on %s(%i)."Cheatsa[code], nameplayerid);
        
ABroadCast(-1,string,1);
    }




Re: Spamming Adminwarn for Anti-Cheat - Japanda - 03.12.2015

Fixed by timers!

Thanks to PawnHunter for a little help & sa-mp wiki.

My problem solved.