command
#1

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(playeridparams[])
{
    
MoneyForBail[playerid] = random(7000) + 1000;
    
MoneyFor[playerid] = MoneyForBail[playerid];
    new 
idpName[MAX_PLAYER_NAME],tName[MAX_PLAYER_NAME],string[128];
    
GetPlayerName(playeridpNamesizeof(pName));
    
GetPlayerName(idtNamesizeof(tName));
    if(
sscanf(params"u"id)) return SendClientMessage(playerid, -1"{FF5044}USAGE: /bail [ID]");
     if(
PlayerInfo[id][pJailed] == 0) return SendClientMessage(playeridred"{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(playeridCOLOR_RED"{FF0000}Error: {FFFFFF}You don't have engouh money to bail yourself."), PlayerPlaySound(playerid54060.00.05.0);
                   
format(fstr2sizeof(fstr2), "{FFFFFF}[JAIL RELEASE]: {FFD700}%s(%d) {FFFFFF}has been released from {33FF33}Jail{FFFFFF}. Bail paid ({33FF33}$%d{FFFFFF})!"GetName(playerid),playeridMoneyForBail[playerid]);
                
SendClientMessageToAll(COLOR_DODGERBLUEfstr2);
                
BailPlayer[playerid] = 0;
                
TextDrawHideForPlayer(playeridTextdraw0);
                
TextDrawHideForPlayer(playeridTextdraw1);
                
TextDrawHideForPlayer(playeridTextdraw2);
                
TextDrawHideForPlayer(playeridTextdraw3);
                
TextDrawHideForPlayer(playeridTextdraw9);
                
escapeText(playerid);
                
KillTimer(pJailTimerID[playerid]);
                 
KillTimer(SendToJail[playerid]);
                
KillTimer(pJailCount[playerid]);
                 
BeginArrested[playerid] = 0;
                  
MoneyForBail[playerid] = 0;
                
SetPlayerInterior(playerid3);
                
PlayerInfo[playerid][pJailed] = 0;
                
SetPlayerPos(playerid199.4501,169.1128,1003.0234);
                
SetPlayerHealth(playerid100);
                
GivePlayerMoney(playerid, -MoneyFor[playerid]);
                
OtherMenuBail[playerid] = 0;
               }
        }
        if(
OtherMenuBail[playerid] == 1)
        {
            if(
PlayerInfo[id][pJailed] == 0) return SendClientMessage(playeridred"{FF0000}Error: This player is not in jail.");
            if(
MoneyForBail[playerid] > GetPlayerCash(id))
            {
                  if(
GetPlayerMoney(id) < MoneyForBail[playerid])
                  {
                        
format(stringsizeof(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,playeridMoneyForBail[playerid]);
                        
SendClientMessageToAll(COLOR_DODGERBLUEstring);
                        
GivePlayerMoney(id, -MoneyFor[playerid]);
                          
BailPlayer[playerid] = 0;
                          
TextDrawHideForPlayer(playeridTextdraw0);
                          
TextDrawHideForPlayer(playeridTextdraw1);
                        
TextDrawHideForPlayer(playeridTextdraw2);
                        
TextDrawHideForPlayer(playeridTextdraw3);
                        
TextDrawHideForPlayer(playeridTextdraw9);
                        
KillTimer(pJailTimerID[playerid]);
                         
KillTimer(SendToJail[playerid]);
                        
KillTimer(pJailCount[playerid]);
                        
BeginArrested[playerid] = 0;
                        
MoneyForBail[playerid] = 0;
                        
SetPlayerInterior(playerid3);
                        
PlayerInfo[playerid][pJailed] = 0;
                        
SetPlayerPos(playerid199.4501,169.1128,1003.0234);
                         
SetPlayerHealth(playerid100);
                         
EnemyBail[id] = 0;
                         
OtherMenuBail[id] = 0;
                         
GivePlayerMoney(id, -MoneyFor[playerid]);
                    }
                    else
                    {
                        
SendClientMessage(playeridCOLOR_RED"{FF0000}Error: {FFFFFF}You don't have engouh money to bail enemy player.");
                        
PlayerPlaySound(playerid54060.00.05.0);
                        return 
0;
                    }
            }
        }
    return 
1;

PHP код:
forward pJailTimer(playerid);
public 
pJailTimer(playerid)
{
    
MoneyFor[playerid] = MoneyForBail[playerid];
    
TextDrawHideForPlayer(playeridTextdraw3);
    
RemovePlayerAttachedObject(playerid9);
    
SetPlayerSpecialAction(playeridSPECIAL_ACTION_NONE);
    
PlayerInfo[playerid][pJailed] = 1;
    
pJailCount[playerid]--;
    new 
string[128];
    
format(stringsizeof(string), "%d"pJailCount[playerid]);
    
TextDrawSetString(Textdraw1string);
    
TextDrawShowForPlayer(playeridTextdraw3);
     
format(stringsizeof(string), "%d"MoneyFor[playerid]);
     
TextDrawSetString(Textdraw3string);
    
SetPlayerInterior(playerid3);
    
SetPlayerHealth(playerid10000000);
    
KillTimer(SendToJail[playerid]);
    
TextDrawShowForPlayer(playeridTextdraw0);
    
TextDrawShowForPlayer(playeridTextdraw1);
    
TextDrawShowForPlayer(playeridTextdraw2);
    
TextDrawShowForPlayer(playeridTextdraw3);
    
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"50005);
        
KillTimer(pJailTimerID[playerid]);
        
KillTimer(SendToJail[playerid]);
        
KillTimer(pJailCount[playerid]);
        
OtherMenuBail[playerid] = 1;
        return 
1;
    }
    return 
1;

Reply


Messages In This Thread
command - by Man43 - 27.09.2018, 16:28

Forum Jump:


Users browsing this thread: 1 Guest(s)