Anti-Money Hack (Buggy)
#1

I've tried making my own money hacks, but I don't know when I execute the command (/givemoney) it bans the player automatically but when I load the player's money from the database and uses the same function to give the player money saved on that database and it doesn't ban that player for some reason I find it strange

pawn Код:
//variables
new OldMoney[MAX_PLAYERS];
new NewMoney[MAX_PLAYERS];

//timer, under OnGameModeInit
SetTimer("CheckMoney",1000,true);

//callback
forward CheckMoney();
public CheckMoney()
{
    new string[128];
    foreach(Player, i)
    {
        if(IsPlayerConnected(i) && IsPlayerOnline[i] == 1)
        {
            if(GetPlayerMoney(i) > NewMoney[i])
            {
                format(string, sizeof(string), "%s(%d) Has been banned Auto-Banned - Reason: Money Hacks",PlayerName(i), i);
                SendClientMessageToAll(COLOR_LIGHTRED, string);
                Log("log/Ban.log", string);
               
                ResetPlayerMoney(i);
                GivePlayerMoney(i,OldMoney[i]);
                BanPlayer(i);
            }
        }
    }
    return 1;
}

//stock
stock GivePlayerMoneyEx(playerid, ammount)
{
    OldMoney[playerid] = GetPlayerMoney(playerid);
    NewMoney[playerid] = ammount;
    GivePlayerMoney(playerid, ammount);
    return 1;
}

//Command
CMD:givemoney(playerid, params[])
{
    new ID, amount, string[128];
    if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, -1, ""COL_RED"[ERROR]"COL_LIGHTBLUE" - You are not high enough to use this command.");
    if(sscanf(params, "ii", ID, amount)) return SendClientMessage(playerid, -1, "[USAGE] - /givemoney ( ID ) ( Amount )");
    if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, -1, ""COL_RED"[ERROR]"COL_LIGHTBLUE" - The player you're trying to give money isn't connected to the server.");

    GivePlayerMoneyEx(ID, amount);
    format(string, sizeof(string),"[AdmWarn]"COL_WHITE" - Administrator %s(%d) has given %s(%d) $%d", PlayerName(playerid), playerid, PlayerName(ID), ID, amount);
    SendAdminMessage(COLOR_LIGHTRED, string);
    Log("log/GiveMoney.log", string);
    return 1;
}
Reply
#2

Like the function says GivePlayerMoney, not Set.

pawn Код:
NewMoney[playerid] += ammount;
Reply
#3

How dumb am I? hahahah, I didn't see that. thanks man!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)