move money hack code to module

This commit is contained in:
Lorenc Pekaj 2019-01-02 03:00:54 +11:00
parent 39d81a63c7
commit 18eb6c9ca6
2 changed files with 9 additions and 6 deletions

View File

@ -23,6 +23,15 @@ static stock
forward OnPlayerMoneyChanged ( playerid, amount ); forward OnPlayerMoneyChanged ( playerid, amount );
/* ** Hooks ** */ /* ** Hooks ** */
hook OnPlayerUpdate( playerid ) {
// reset the player's money if it is inaccurate
if ( p_Cash[ playerid ] != GetPlayerMoney( playerid ) ) {
ResetPlayerMoney( playerid );
GivePlayerMoney( playerid, p_Cash[ playerid ] );
}
return 1;
}
hook OnVehicleMod( playerid, vehicleid, componentid ) hook OnVehicleMod( playerid, vehicleid, componentid )
{ {
switch( componentid ) switch( componentid )

View File

@ -329,12 +329,6 @@ public OnServerUpdateTimer( )
ShowPlayerHelpDialog( playerid, 1200, "You have been tied for %s.~n~~n~Your tie is loose.", secondstotime( g_iTime - p_TimeTiedAt[ playerid ] ) ); ShowPlayerHelpDialog( playerid, 1200, "You have been tied for %s.~n~~n~Your tie is loose.", secondstotime( g_iTime - p_TimeTiedAt[ playerid ] ) );
} }
// Anti Money Hack
if ( GetPlayerCash( playerid ) != GetPlayerMoney( playerid ) ) {
ResetPlayerMoney( playerid );
GivePlayerMoney( playerid, GetPlayerCash( playerid ) );
}
if ( p_AdminLevel[ playerid ] < 1 ) if ( p_AdminLevel[ playerid ] < 1 )
{ {
/* ANTICHEAT */ /* ANTICHEAT */