AntiCheat not working...
#1

Hello
I made an anti-cheat some time ago but it didn't work very well...
I made a few changes to it (for ex, instead of using onplayerupdate i used a timer) but it made it even worse...
And it's behavior is very weird

Here's the timer that gets called once every second.
pawn Код:
public AntiMoneyHack()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(GetPlayerMoney(i) > pMoney[i])
            {
                new playername[MAX_PLAYER_NAME],string[128];
                GetPlayerName(i,playername,sizeof(playername));
                format(string,sizeof(string),"Server: {FF0000}%s {FFFFFF}was banned, reason: {FF0000}Money Hack{FFFFFF}",playername);
                for(new b=0; i<MAX_PLAYERS; i++)
                {
                    if(IsPlayerConnected(b))
                    {
                        if(pInfo[b][Admin] >= 1)
                        {
                            SCM(b,COLOR_LIGHTRED,string);
                            new string500[128];
                            format(string500,sizeof(string500),"DEBUG: Your money: %d Server Money %d",GetPlayerMoney(b),pMoney[b]);
                            SCM(b,COLOR_WHITE,string500);
                        }
                    }
                }
                new logstring[256],d,m,y,h,mi,s;
                gettime(h,mi,s);
                getdate(y,m,d);
                new plrIP[16];
                GetPlayerIp(i, plrIP, sizeof(plrIP));
                format(logstring,sizeof(logstring),"%d/%d/%d %d:%d:%d Server: %s[%s] was banned, reason: Money Hack",d,m,y,h,mi,s,playername,plrIP);
                Log(logstring);
                SafeResetPlayerMoney(i);
                new banstring[128];
                format(banstring,sizeof(banstring),"banip %s",plrIP);
                SendRconCommand(banstring);
                SendRconCommand("reloadbans");
                pInfo[i][Banned]=1;
                SetTimerEx("TimeKick",500,false,"i",i);
            }
        }
    }
}
And this is what crashdetect has to say about it
Код:
[12:35:57] [debug] Run time error 4: "Array index out of bounds"
[12:35:57] [debug]  Accessing element at index 500 past array upper bound 499
[12:35:57] [debug] AMX backtrace:
[12:35:57] [debug] #0 00083498 in ?? (0x000001f4) from GM.amx
[12:35:57] [debug] #1 0008dddc in public AntiMoneyHack () from GM.amx
The thing is that it randomly bans players when they die (at least it says so in the logs, but players don't get banned and the admins don't get notified about the cheater).
OnPlayerDeath doesn't handle any money, so i don't think that's the problem. However OnPlayerSpawn does, it charges the medic fee and also gives 100$ (as you may know, when you die, you automatically lose 100$, and ofc the money are taken with the default giveplayermoney...).
P.S.: It doesn't detect money cheaters also

Any help please? Thanks
Reply


Messages In This Thread
AntiCheat not working... - by Vlad64 - 11.08.2014, 09:41
Re: AntiCheat not working... - by Vlad64 - 11.08.2014, 18:40
Re: AntiCheat not working... - by Blast3r - 11.08.2014, 18:58
Re: AntiCheat not working... - by Vlad64 - 11.08.2014, 20:11
Re: AntiCheat not working... - by Vlad64 - 11.08.2014, 23:53

Forum Jump:


Users browsing this thread: 1 Guest(s)