Spamming Adminwarn for Anti-Cheat
#1

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

there is not any way?
Reply
#3

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);
    }

Reply
#4

Fixed by timers!

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

My problem solved.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)