Posts: 871
Threads: 114
Joined: May 2014
Quote:
Originally Posted by FunnyBear
Код:
//AT THE TOP
#define ResetMoneyBar ResetPlayerMoney
#define UpdateMoneyBar GivePlayerMoney
new Cash[MAX_PLAYERS];
//OnPlayerConnect
ResetPlayerCash(playerid);
//somewhere in your script
stock GivePlayerCash(playerid, money)
{
Cash[playerid] += money;
ResetMoneyBar(playerid);
UpdateMoneyBar(playerid,Cash[playerid]);
return Cash[playerid];
}
stock SetPlayerCash(playerid, money)
{
Cash[playerid] = money;
ResetMoneyBar(playerid);
UpdateMoneyBar(playerid,Cash[playerid]);
return Cash[playerid];
}
stock ResetPlayerCash(playerid)
{
Cash[playerid] = 0;
ResetMoneyBar(playerid);
UpdateMoneyBar(playerid,Cash[playerid]);
return Cash[playerid];
}
stock GetPlayerCash(playerid)
{
return Cash[playerid];
}
If you were to Give someone money, use GivePlayerCash and not GivePlayerMoney. So with ResetPlayerMoney, use ResetPlayerCash.. etc.
Example command
pawn Код:
CMD:givemoney(playerid, params[]) { new amount, id; if( sscanf( params, "sd", id, amount ) ) return SendClientMessage( playerid, -1, "USAGE: /givemoney [ID] [Money" );
if( id == playerid ) return SendClientMessage(playerid, -1, "ERROR: You cannot set your own cash!");
if( id == INVALID_PLAYER_ID ) return SendClientMessage(playerid, -1, "ERROR: Player is not connected"); GivePlayerCash(id, money); // Don't use GivePlayerMoney, use the function created return 1; }
To check if the player hacked the money, make a timer and do something like this
pawn Код:
// OnPlayerConnect SetTimerEx( "AntiCheat",100, true, "i", playerid);
//Somewhere in your script forward AntiCheat(playerid); public AntiCheat(playerid) { if(GetPlayerCash(playerid) != GetPlayerMoney(playerid)) { ResetMoneyBar(playerid); UpdateMoneyBar(playerid, GetPlayerCash(playerid)); Kick(playerid); // kick or ban the playerid and do what you want with the player } }
|
Just combinate with your script and use
REMEMBER: Add it on GameMode not in FilterScript