Anti Money Hack Problem
#1

i use a timer to check every 3 seconds player's money

pawn Код:
forward MoneyTimer();
public MoneyTimer()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && IsSpawned[i] == 1)
        {
            if(GetPlayerCash(i) != GetPlayerMoney(i))
            {
                new string[128];
                new hack = GetPlayerMoney(i) - GetPlayerCash(i);
                format(string, sizeof(string), "[AUTO BAN] %s(%d) has been banned by the Anti-Cheat for cash hacking (%d).",PlayerName(i),i,hack);
                SendClientMessageToAll(COLOR_ADMIN, string);

                format(string, sizeof(string), "9[AUTO BAN] %s(%d) has been banned by the Anti-Cheat for cash hacking (%d).",PlayerName(i),i,hack);
                IRC_GroupSay(gGroupID, IRC_CHANNEL,string);

                SendClientMessage(i,COLOR_RED,"You have been banned from this server for spawning money.");
                SendClientMessage(i,COLOR_RED,"You can appeal this ban on the forums, http://www.TeamMob.GA but we usually don't unban hackers.");

                new Query[200], Name[MAX_PLAYER_NAME + 2], IP[16], Day, Month, Year, Hour, Minute;
                mysql_real_escape_string(PlayerName(i), Name);
                GetPlayerIp(i, IP, sizeof(IP));
                getdate(Year, Month, Day);
                gettime(Hour, Minute);
                format(string, sizeof(string), "%02d:%02d %02d/%02d/%d", Hour, Minute, Day, Month, Year);
                format(Query, sizeof(Query), "INSERT INTO `bans` (`Name`, `IP`, `Reason`, `Date`, `Admin`) VALUES ('%s', '%s', 'Spawning Money ($d)', '%s', 'Anti-Cheat')", Name, IP, hack, string);
                mysql_query(Query);
                ResetMoneyBar(i);//Resets the money in the original moneybar, Do not remove!
                UpdateMoneyBar(i,GetPlayerCash(i));//Sets the money in the moneybar to the serverside cash, Do not remove!
                Banning[i] =1;
                //sql_setValue(pname, "BanReason", "Spawning Money");
                SetTimer("BanPlayer",700,0);
            }
        }
    }
}
pawn Код:
#define ResetMoneyBar ResetPlayerMoney
#define UpdateMoneyBar GivePlayerMoney
and
pawn Код:
stock GivePlayerCash(playerid, money)
{
    Cash[playerid] += money;
    ResetMoneyBar(playerid);//Resets the money in the original moneybar, Do not remove!
    UpdateMoneyBar(playerid,Cash[playerid]);//Sets the money in the moneybar to the serverside cash, Do not remove!
    return Cash[playerid];
}
stock SetPlayerCash(playerid, money)
{
    Cash[playerid] = money;
    ResetMoneyBar(playerid);//Resets the money in the original moneybar, Do not remove!
    UpdateMoneyBar(playerid,Cash[playerid]);//Sets the money in the moneybar to the serverside cash, Do not remove!
    return Cash[playerid];
}
stock ResetPlayerCash(playerid)
{
    Cash[playerid] = 0;
    ResetMoneyBar(playerid);//Resets the money in the original moneybar, Do not remove!
    UpdateMoneyBar(playerid,Cash[playerid]);//Sets the money in the moneybar to the serverside cash, Do not remove!
    return Cash[playerid];
}
stock GetPlayerCash(playerid)
{
    return Cash[playerid];
}
Everything works but when a player die he ban him for hacking $-100 , Nothing under OnPlayerDeath , i found my money decrease and increase after death then "hacking $-100" ?
Reply
#2

Check fixes.inc
Reply
#3

Just change if(GetPlayerCash(i) != GetPlayerMoney(i)) to if(GetPlayerCash(i) < GetPlayerMoney(i))
Since no one would hack to lower his money, they only have to have more.
Reply
#4

When you die, SA:MP automatically removes $100.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)