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.