25.07.2018, 10:02
stores the money in a variable.
PHP Code:
new MoneyForBail[MAX_PLAYERS]; // global variable, reset at OnPlayerConnect
if(BailPlayer[playerid] == 1)
{
MoneyForBail[playerid] = random(7000) + 1000;
if(MoneyForBail[playerid] > GetPlayerCash(playerid))
{
if(GetPlayerMoney(playerid) < MoneyForBail[playerid]) return SendClientMessage(playerid, COLOR_RED, "{FF0000}Error: {FFFFFF}You don't have engouh money to bail yourself.");
....
forward pJailTimer(playerid);
public pJailTimer(playerid)
{
RemovePlayerAttachedObject(playerid, 9);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
PlayerInfo[playerid][pJailed] = 1;
pJailCount[playerid]--;
new string[128];
format(string, sizeof(string), "%d", pJailCount[playerid]);
TextDrawSetString(Textdraw1, string);
format(string, sizeof(string), "$%d", MoneyForBail[playerid]);
...
MoneyForBail[playerid] = 0;