How to
#1

How To I can fix this problem? What is it? When Someone bail me from the jailed they are SENDING 2 message's to all players why? I just want If someone bailed me from the jailed they must only saying " Confinement Payment " and If I bailed myself they should saying [JAIL RELEASE] How to do that?


PHP код:
CMD:bail(playeridparams[])
{
    new 
pName[MAX_PLAYER_NAME],tName[MAX_PLAYER_NAME],targetid;
    new 
string[128];
    
GetPlayerName(playeridpNamesizeof(pName));
    
GetPlayerName(targetidtNamesizeof(tName));
    if(
sscanf(params"u"playerid)) return SendClientMessage(playeridCOLOR_WHITE"{FF0000}Error: /Bail <playerid>");
    if(!
IsPlayerConnected(targetid)) return SendClientMessage(playerid, -1"{FF0000}Error: {FFFFFF}Invaild Player.");
    if(
PlayerInfo[playerid][pJailed] == 0) return SendClientMessage(playeridred"{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(playeridCOLOR_RED"{FF0000}Error: {FFFFFF}You don't have engouh money to bail yourself.");
            
BailPlayer[playerid] = 0;
            
format(fstrsizeof(fstr), "[DISPATCH]: Suspect %s[%d) has bail himself."pNameplayerid);
            
CopRadio(COLOR_DODGERBLUEfstr);
            
            
format(fstr2sizeof(fstr2), "{FFFFFF}[JAIL RELEASE]: {FFD700}%s(%d) {FFFFFF}has been released from {33FF33}Jail{FFFFFF}. Bail paid ({33FF33}$%d{FFFFFF})!"pName,playeridMoneyForBail[playerid]);
            
SendClientMessageToAll(COLOR_DODGERBLUEfstr2);
            
            
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_DODGERBLUEstring);
            
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);
            
GivePlayerMoney(playerid, -MoneyForBail[playerid]);
            
GivePlayerMoney(targetid, -MoneyForBail[playerid]);
        }
    }
    return 
1;

Reply
#2

PHP код:
 SendClientMessageToAll(COLOR_DODGERBLUEfstr2); 
You used SendClientMessageToAll instead of using SendClientMessage.
Reply
#3

Can you explain more?
Reply
#4

You were saying that all players are getting the jail releases and confinement payment messages.
Right?

That why because you've used SendClientMessageToAll.
Reply
#5

So what? I want All players show the message's.. What's the problem
Reply
#6

I think this is what you're wanting?

pawn Код:
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);
}
You should also check your code more thoroughly as you mix 'targetid' with 'playerid' in the wrong places.

pawn Код:
if(sscanf(params, "u", playerid)) return SendClientMessage(playerid, COLOR_WHITE, "{FF0000}Error: /Bail <playerid>"); //should be targetid, not playerid
Reply
#7

this is full command

PHP код:
CMD:bail(playeridparams[])
{
    new 
pName[MAX_PLAYER_NAME],tName[MAX_PLAYER_NAME],targetid;
    new 
string[128];
    
GetPlayerName(playeridpNamesizeof(pName));
    
GetPlayerName(targetidtNamesizeof(tName));
    if(
sscanf(params"u"playerid)) return SendClientMessage(playeridCOLOR_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(playeridred"{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(playeridCOLOR_RED"{FF0000}Error: {FFFFFF}You don't have engouh money to bail yourself.");
            if(
targetid == playerid)
            {
                
format(fstr2sizeof(fstr2), "{FFFFFF}[JAIL RELEASE]: {FFD700}%s(%d) {FFFFFF}has been released from {33FF33}Jail{FFFFFF}. Bail paid ({33FF33}$%d{FFFFFF})!"pName,playeridMoneyForBail[playerid]);
                
SendClientMessageToAll(COLOR_DODGERBLUEfstr2);
            }
            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_DODGERBLUEstring);
            }
            
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);
            
GivePlayerMoney(playerid, -MoneyForBail[playerid]);
            
GivePlayerMoney(targetid, -MoneyForBail[playerid]);
        }
    }
    return 
1;

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?
Reply
#8

anyone help me?
Reply
#9

pawn Код:
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]);
            SendClientMessage(playerid,COLOR_DODGERBLUE, string);
Reply
#10

but I want this message send to all players. and what u change extacly? Only SendClientMessageToAll?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)