11.08.2018, 13:22
this is full command
Example: I just want If someone typing /bail [ID] and the player got released from jailed by a player they must saying %s has paid do you understand me? and If the player payed himself It's worked.. Just the player if bailed other players not worked why?
PHP код:
CMD:bail(playerid, params[])
{
new pName[MAX_PLAYER_NAME],tName[MAX_PLAYER_NAME],targetid;
new string[128];
GetPlayerName(playerid, pName, sizeof(pName));
GetPlayerName(targetid, tName, sizeof(tName));
if(sscanf(params, "u", playerid)) return SendClientMessage(playerid, COLOR_WHITE, "{FF0000}Error: /Bail <playerid>"); //should be targetid, not playerid
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, -1, "{FF0000}Error: {FFFFFF}Invaild Player.");
if(PlayerInfo[playerid][pJailed] == 0) return SendClientMessage(playerid, red, "{FF0000}Error: This player is not in jail.");
PayTheJail[targetid] = playerid;
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.");
if(targetid == playerid)
{
format(fstr2, sizeof(fstr2), "{FFFFFF}[JAIL RELEASE]: {FFD700}%s(%d) {FFFFFF}has been released from {33FF33}Jail{FFFFFF}. Bail paid ({33FF33}$%d{FFFFFF})!", pName,playerid, MoneyForBail[playerid]);
SendClientMessageToAll(COLOR_DODGERBLUE, fstr2);
}
else
{
format(string,sizeof(string),"{3DB9E7}[Confinement Payment]: {FFFFFF}Player {3DB9E7}%s(%d) {FFFFFF}has PAID the bail of the jailed to {3DB9E7}%s(%d). {FFFFFF}Bail Was: {36FF00}$%d{FFFFFF}!",pName,playerid,tName,targetid,MoneyForBail[playerid]);
SendClientMessageToAll(COLOR_DODGERBLUE, string);
}
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, -MoneyForBail[playerid]);
GivePlayerMoney(targetid, -MoneyForBail[playerid]);
}
}
return 1;
}