Best Anti-Money Hack Method (Server Sided Money) Discussion -
Dorito - 04.12.2016
The title says it all and this goes out to all you experienced scripters, what's the best way to make a anti-money hack and how would you implement it.
Re: Best Anti-Money Hack Method (Server Sided Money) Discussion -
Amads - 04.12.2016
Don't use default money system, create your own.
Re: Best Anti-Money Hack Method (Server Sided Money) Discussion -
Abagail - 04.12.2016
The easiest way is to store players money in a variable, and update it when it changes(also should set the actual game money too when updating so the player sees the correct amount). If the players money gamewise isn't whats set, they might be hacking(you should also consider things such as lag or desync). Using this method, if you use your own variable for everything dealing with money in the script, they won't be able to do anything with money they hack.
Re: Best Anti-Money Hack Method (Server Sided Money) Discussion -
Dignity - 04.12.2016
Since you saved me from creating my own thread, I'll hijack it with a question and also a possible example.
Would this be a viable anti cheat? Please tell me why not if it's not.
PHP Code:
OnPlayerMoneyChange ( playerid ) {
new string [ 64 ] ;
if ( AC_GetPlayerMoney ( playerid ) != GetPlayerMoney ( playerid ) ) {
format ( string, sizeof ( string ), "ANTICHEAT: Serverside money: %d | Clientside money: %d", AC_GetPlayerMoney ( playerid ), GetPlayerMoney ( playerid ) );
SendClientMessage ( playerid, ANTICHEAT_COLOUR, string ) ;
}
return true ;
}
AC_GetPlayerMoney ( playerid ) {
OnPlayerMoneyChange ( playerid ) ;
return antiCheat_playerMoney [ playerid ] ;
}
AC_GivePlayerMoney ( playerid, amount ) {
antiCheat_playerMoney [ playerid ] += amount ;
OnPlayerMoneyChange ( playerid ) ; // Anti cheat
return GivePlayerMoney ( playerid, amount );
}
#define GivePlayerMoney AC_GivePlayerMoney
Re: Best Anti-Money Hack Method (Server Sided Money) Discussion -
Stinged - 04.12.2016
Quote:
Originally Posted by Dignity
Since you saved me from creating my own thread, I'll hijack it with a question and also a possible example.
Would this be a viable anti cheat? Please tell me why not if it's not.
PHP Code:
OnPlayerMoneyChange ( playerid ) {
new string [ 64 ] ;
if ( AC_GetPlayerMoney ( playerid ) != GetPlayerMoney ( playerid ) ) {
format ( string, sizeof ( string ), "ANTICHEAT: Serverside money: %d | Clientside money: %d", AC_GetPlayerMoney ( playerid ), GetPlayerMoney ( playerid ) );
SendClientMessage ( playerid, ANTICHEAT_COLOUR, string ) ;
}
return true ;
}
AC_GetPlayerMoney ( playerid ) {
OnPlayerMoneyChange ( playerid ) ;
return antiCheat_playerMoney [ playerid ] ;
}
AC_GivePlayerMoney ( playerid, amount ) {
antiCheat_playerMoney [ playerid ] += amount ;
OnPlayerMoneyChange ( playerid ) ; // Anti cheat
return GivePlayerMoney ( playerid, amount );
}
#define GivePlayerMoney AC_GivePlayerMoney
|
AC_GivePlayerMoney will give false warnings.
The order goes like this:
variable change
OnPlayerMoneyChange
GivePlayerMoney
So basically, you're calling the anticheat before giving the actual money.
Which means the variable != the money, because you haven't given the money yet.
Re: Best Anti-Money Hack Method (Server Sided Money) Discussion -
Logic_ - 04.12.2016
I'd do as said by Abagail.
Re: Best Anti-Money Hack Method (Server Sided Money) Discussion -
Dignity - 04.12.2016
Quote:
Originally Posted by Stinged
AC_GivePlayerMoney will give false warnings.
The order goes like this:
variable change
OnPlayerMoneyChange
GivePlayerMoney
So basically, you're calling the anticheat before giving the actual money.
Which means the variable != the money, because you haven't given the money yet.
|
Hey, thanks man. Didn't really test it yet, so it was just a draft. I'll edit it
Re: Best Anti-Money Hack Method (Server Sided Money) Discussion -
Vince - 04.12.2016
You should only really be checking if client side money is
more than what it should be. Doesn't really matter if it's less. If the default shops or the vending machines are active in your server then the anti-cheat will notice an anomaly and it will flag the player as a cheater.
Re: Best Anti-Money Hack Method (Server Sided Money) Discussion -
SickAttack - 07.12.2016
The best method would definitely be:
1. Save the amount of money the player has in an array
2. Hook the native functions so it uses the array
3. Update the player's money on their HUD to the value the array holds
4. Don't include a detection, just set the displayed value on the player's HUD to the value the array holds when the player's money changes
Re: Best Anti-Money Hack Method (Server Sided Money) Discussion -
theYiin - 17.12.2016
PHP Code:
PlayerMoney(playerid, amount = -1) {
static money[MAX_PLAYERS];
if(amount != -1) {
money[playerid] = amount;
GivePlayerMoney(playerid, amount - GetPlayerMoney(playerid));
}
return money[playerid];
}
// set
PlayerMoney(playerid, 5000);
// get
new amountOfMoneyPlayerHas = PlayerMoney(playerid);