18.08.2018, 23:33
Hey How To I can make this command such as If the player In jailed and the timer of jailed has ended the enemy players can bail this player and he can bail himself if he want! How to do that? Such as If the enemy player bail him They must send message to all players %s has bail the player of jailed %s like that. I've putting in the public when timer is ended a OtherMenu[playerid] = 1; but when I typing /bail ID the enemy player dose not leaving the jailed why? can u help me?
// In the public
Command is:
// In the public
PHP код:
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[id] = 1;
return 1;
}
PHP код:
CMD:bail(playerid, params[])
{
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)
{
MoneyForBail[playerid] = random(7000) + 1000;
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.");
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);
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]);
}
}
else 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])
{
if(PlayerInfo[id][pJailed] == 1)
{
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;
}
else
{
SendClientMessage(playerid, COLOR_RED, "{FF0000}Error: {FFFFFF}You don't have engouh money to bail enemy player.");
return 0;
}
}
else
{
format(string,sizeof(string), "{00BDFF}[Jail]: [ERROR]: {FFFFFF}%s(%d) has not served their minimum Jail Sentence yet. {FFFFFF}Time left: {0080FF}%d{FFFFFF}.", pName,playerid, pJailCount[playerid]);
SendClientMessage(playerid, -1, string);
return 0;
}
}
}
return 1;
}