#anti money hack

10 messages · Page 1 of 1 (latest)

mental spear
#

The point of using variables in this case is to not allow players to fake it, if a player cheats money, using GetPlayerMoney you will get the amount of money they cheated so a simple solution is to do something like this

new playerMoney[MAX_PLAYERS] = { 0, ...};

stock Player_GiveMoney(playerid, money) {
    if (!IsPlayerConnected(playerid)) {
        return 0;
    }

    playerMoney[playerid] += money;
    return 1;
}

stock Player_SetMoney(playerid, money) {
    if (!IsPlayerConnected(playerid)) {
        return 0;
    }

    playerMoney[playerid] = money;
    return 1;
}

stock Player_GetMoney(playerid) {
    if (!IsPlayerConnected(playerid)) {
        return 0;
    }

    return playerMoney[playerid];
}

as @peak mantle said, if you want to change the actual money in the hud you will also have to use the native functions in there, but just for display, and if you want to check if a player has the right amount of money you just do

new price = 500;

if (Player_GetMoney(playerid) < price) {
  // code
}
inner olive
#

I understand, is there a way to hide the money from the hud then? maybe create a textdraw to hide or show variable money in hud

mental spear
#

Umm I'm not sure about hiding the default one, I think it's not possible

candid lantern
#

You cannot hide it. But you can create a textdraw over-lay over it. Just re-create it on your own.

indigo bolt
#

Use OnPlayerUpdate to detect money changes that weren't set in the script, then set it back to what it was prior to changing. I allow changes of -1 to -100 to support pay n sprays, fast food, and vending machines (after all, what hacker is going to change their money to -1 to -100 less than what it already is...) .
Obviously I have disabled casino games and I use scripted mod shops, so no client money change will exceed -100 . If you want keep casino games then this method isn't suitable for you, however if you'd like to disable them I can provide you with the lines you need to do it.

#

To remove casino games - https://pastebin.com/3wigg6VA
To re-add them as unusable - https://pastebin.com/wY9pfnSK

placid aurora
# indigo bolt Use OnPlayerUpdate to detect money changes that weren't set in the script, then ...

No need to make it in OnPlayerUpdate as they updates in different sync (StatsUpdate) which is called every (few) second(s), not more often. Moreover, ignoring small amount changes by "supporting something from sp" you just allow cheaters to gradually (step by step) spoof bigger amounts of money with it (mainly speaking about cases where player can add them). Support singleplayer game systems is also about positions checks and other similar conditions

mental spear
#

I myself also am not a fan of using OnPlayerUpdate for something like that, either make a custom timer (3-10 seconds) since they won't be to do anything with the money if you check everywhere using the custom function that money wont ever be saved/loaded

inner olive
#

what are these casino games? vending machines are off by default, aren't they?

indigo bolt
#

@placid aurora I don't allow positive money changes from the client. Gambling is disabled, and all other single player money changes are negative. I allow only amounts between -1 and -100. No cheater is going to lower their money by these amounts.. and even if they did, what's the big deal? It's their loss.
@inner olive they're roulette, blackjack, the wheel, video poker and slot machines. Disable them and if the players money increases without the script knowing then they're using hacks.