SA-MP Forums Archive
Anti-Money hack script does not work properly - 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: Anti-Money hack script does not work properly (/showthread.php?tid=529459)



Anti-Money hack script does not work properly - Vlad64 - 02.08.2014

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


Re: Anti-Money hack script does not work properly - McBan - 02.08.2014

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



Re: Anti-Money hack script does not work properly - Vlad64 - 02.08.2014

Same problem...


Re: Anti-Money hack script does not work properly - Stinged - 02.08.2014

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.


Re: Anti-Money hack script does not work properly - Vlad64 - 02.08.2014

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