//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]; }
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;
}
// 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
}
}
Код:
//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]; } Example command pawn Код:
pawn Код:
|