Anti-Money hack script does not work properly
#1

Hello, i tried to make my own little anti-money hack script, but it keeps banning even the money were legit.
I noticed it does so when giving it negative values (to take money from the player) so i tried to modify it a bit, however it's still bugged...
A little help please?

This is the SafeGivePlayerMoney function
pawn Код:
stock abs( value )
{
   return ( ( value < 0 ) ? ( value * -1 ) : ( value ) );
}

stock SafeGivePlayerMoney(playerid, money)
{
    if(money > 0)
    {
        pMoney[playerid] += money;
    }
    else
    {
        pMoney[playerid] -= abs(money);
    }
    GivePlayerMoney(playerid, money);
}
And this is the script that checks if pMoney is equal to the player's money
pawn Код:
public OnPlayerUpdate(playerid)
{
    if(!IsPlayerConnected(playerid)) return 0;
    if(GetPlayerMoney(playerid) != pMoney[playerid])
    {
        new playername[MAX_PLAYER_NAME],string[128];
        GetPlayerName(playerid,playername,sizeof(playername));
        format(string,sizeof(string),"Server: {FF0000}%s {FFFFFF}was banned, reason: {FF0000}Money Hack{FFFFFF}",playername);
        for(new i=0; i<MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                if(pInfo[i][Admin] >= 1)
                {
                    SCM(i,COLOR_LIGHTRED,string);
                }
            }
        }
        new logstring[256],d,m,y,h,mi,s;
        gettime(h,mi,s);
        getdate(y,m,d);
        new plrIP[16];
        GetPlayerIp(playerid, 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(playerid);
        new banstring[128];
        format(banstring,sizeof(banstring),"banip %s",plrIP);
        SendRconCommand(banstring);
        SendRconCommand("reloadbans");
        pInfo[playerid][Banned]=1;
        SetTimerEx("TimeKick",500,false,"i",playerid);
    }
    return 1;
}
Thanks
Reply
#2

Try this.

Код:
public OnPlayerUpdate(playerid)
{
    if(!IsPlayerConnected(playerid)) return 1;
    if(GetPlayerMoney(playerid) != pMoney[playerid])
    {
        new playername[MAX_PLAYER_NAME],string[128];
        GetPlayerName(playerid,playername,sizeof(playername));
        format(string,sizeof(string),"Server: {FF0000}%s {FFFFFF}was banned, reason: {FF0000}Money Hack{FFFFFF}",playername);
        for(new i=0; i<MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                if(pInfo[i][Admin] >= 1)
                {
                    SCM(i,COLOR_LIGHTRED,string);
                }
            }
        }
        new logstring[256],d,m,y,h,mi,s;
        gettime(h,mi,s);
        getdate(y,m,d);
        new plrIP[16];
        GetPlayerIp(playerid, 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(playerid);
        new banstring[128];
        format(banstring,sizeof(banstring),"banip %s",plrIP);
        SendRconCommand(banstring);
        SendRconCommand("reloadbans");
        pInfo[playerid][Banned]=1;
        SetTimerEx("TimeKick",500,false,"i",playerid);
    }
    return 1;
}
Reply
#3

Same problem...
Reply
#4

SA-MP removes 100$ from the player's money when they die.
Replace this
pawn Код:
if(GetPlayerMoney(playerid) != pMoney[playerid])
With this
pawn Код:
if(GetPlayerMoney(playerid) > pMoney[playerid])
Hackers will only hack to get more money.
Reply
#5

Quote:
Originally Posted by Stinged
Посмотреть сообщение
SA-MP removes 100$ from the player's money when they die.
Replace this
pawn Код:
if(GetPlayerMoney(playerid) != pMoney[playerid])
With this
pawn Код:
if(GetPlayerMoney(playerid) > pMoney[playerid])
Hackers will only hack to get more money.
Hahaha, thank you very much
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)