27.09.2018, 16:28
How To I can fix this command? The problem is when I'm trying to bail someone they must saying in main chat like that: %s(%d) has PAYED a bail for enemy player %s(%d). Bail Amount: %d but it's not worked like that why? I alwys when trying to bail someone they will saying like that: %s(%d) has realesd from jail. why? Can you help me please?
PHP код:
CMD:bail(playerid, params[])
{
MoneyForBail[playerid] = random(7000) + 1000;
MoneyFor[playerid] = MoneyForBail[playerid];
new id, pName[MAX_PLAYER_NAME],tName[MAX_PLAYER_NAME],string[128];
GetPlayerName(playerid, pName, sizeof(pName));
GetPlayerName(id, tName, sizeof(tName));
if(sscanf(params, "u", id)) return SendClientMessage(playerid, -1, "{FF5044}USAGE: /bail [ID]");
if(PlayerInfo[id][pJailed] == 0) return SendClientMessage(playerid, red, "{FF0000}Error: This player is not in jail.");
if(BailPlayer[playerid] == 1)
{
if(MoneyForBail[playerid] > GetPlayerCash(playerid))
{
MoneyFor[playerid] = MoneyForBail[playerid];
if(GetPlayerMoney(playerid) < MoneyForBail[playerid]) return SendClientMessage(playerid, COLOR_RED, "{FF0000}Error: {FFFFFF}You don't have engouh money to bail yourself."), PlayerPlaySound(playerid, 5406, 0.0, 0.0, 5.0);
format(fstr2, sizeof(fstr2), "{FFFFFF}[JAIL RELEASE]: {FFD700}%s(%d) {FFFFFF}has been released from {33FF33}Jail{FFFFFF}. Bail paid ({33FF33}$%d{FFFFFF})!", GetName(playerid),playerid, MoneyForBail[playerid]);
SendClientMessageToAll(COLOR_DODGERBLUE, fstr2);
BailPlayer[playerid] = 0;
TextDrawHideForPlayer(playerid, Textdraw0);
TextDrawHideForPlayer(playerid, Textdraw1);
TextDrawHideForPlayer(playerid, Textdraw2);
TextDrawHideForPlayer(playerid, Textdraw3);
TextDrawHideForPlayer(playerid, Textdraw9);
escapeText(playerid);
KillTimer(pJailTimerID[playerid]);
KillTimer(SendToJail[playerid]);
KillTimer(pJailCount[playerid]);
BeginArrested[playerid] = 0;
MoneyForBail[playerid] = 0;
SetPlayerInterior(playerid, 3);
PlayerInfo[playerid][pJailed] = 0;
SetPlayerPos(playerid, 199.4501,169.1128,1003.0234);
SetPlayerHealth(playerid, 100);
GivePlayerMoney(playerid, -MoneyFor[playerid]);
OtherMenuBail[playerid] = 0;
}
}
if(OtherMenuBail[playerid] == 1)
{
if(PlayerInfo[id][pJailed] == 0) return SendClientMessage(playerid, red, "{FF0000}Error: This player is not in jail.");
if(MoneyForBail[playerid] > GetPlayerCash(id))
{
if(GetPlayerMoney(id) < MoneyForBail[playerid])
{
format(string, sizeof(string), "{FFFFFF}[JAIL RELEASE]: {FFD700}%s(%d) {FFFFFF}has been {00FF0C}PAYED {FFFFFF}a bail for enemy Player {FFD700}%s(%d){FFFFFF}. Bail Paid: ({33FF33}$%d{FFFFFF})!", tName,id,pName,playerid, MoneyForBail[playerid]);
SendClientMessageToAll(COLOR_DODGERBLUE, string);
GivePlayerMoney(id, -MoneyFor[playerid]);
BailPlayer[playerid] = 0;
TextDrawHideForPlayer(playerid, Textdraw0);
TextDrawHideForPlayer(playerid, Textdraw1);
TextDrawHideForPlayer(playerid, Textdraw2);
TextDrawHideForPlayer(playerid, Textdraw3);
TextDrawHideForPlayer(playerid, Textdraw9);
KillTimer(pJailTimerID[playerid]);
KillTimer(SendToJail[playerid]);
KillTimer(pJailCount[playerid]);
BeginArrested[playerid] = 0;
MoneyForBail[playerid] = 0;
SetPlayerInterior(playerid, 3);
PlayerInfo[playerid][pJailed] = 0;
SetPlayerPos(playerid, 199.4501,169.1128,1003.0234);
SetPlayerHealth(playerid, 100);
EnemyBail[id] = 0;
OtherMenuBail[id] = 0;
GivePlayerMoney(id, -MoneyFor[playerid]);
}
else
{
SendClientMessage(playerid, COLOR_RED, "{FF0000}Error: {FFFFFF}You don't have engouh money to bail enemy player.");
PlayerPlaySound(playerid, 5406, 0.0, 0.0, 5.0);
return 0;
}
}
}
return 1;
}
PHP код:
forward pJailTimer(playerid);
public pJailTimer(playerid)
{
MoneyFor[playerid] = MoneyForBail[playerid];
TextDrawHideForPlayer(playerid, Textdraw3);
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);
TextDrawShowForPlayer(playerid, Textdraw3);
format(string, sizeof(string), "%d", MoneyFor[playerid]);
TextDrawSetString(Textdraw3, string);
SetPlayerInterior(playerid, 3);
SetPlayerHealth(playerid, 10000000);
KillTimer(SendToJail[playerid]);
TextDrawShowForPlayer(playerid, Textdraw0);
TextDrawShowForPlayer(playerid, Textdraw1);
TextDrawShowForPlayer(playerid, Textdraw2);
TextDrawShowForPlayer(playerid, Textdraw3);
escaped[playerid] = 1;
escape(playerid);
if(pJailCount[playerid] == 0)
{
BailPlayer[playerid] = 1;
SendClientMessage(playerid, -1, "Jail Sentence served! Type {0080FF}/bail {FFFFFF}to get out.");
GameTextForPlayer(playerid, "~B~/BAIL TO LEAVE ~R~JAILED", 5000, 5);
KillTimer(pJailTimerID[playerid]);
KillTimer(SendToJail[playerid]);
KillTimer(pJailCount[playerid]);
OtherMenuBail[playerid] = 1;
return 1;
}
return 1;
}