format dialog?
#1

Hello. I'm trying to make this command show players that currently have hit on in a dialog, but it only shows one line. It's OK, if I use SendClientMessage(), but I want to show in a dialog! Here's the code:
pawn Код:
CMD:bounties(playerid, params[])
{
    new message1[170];
    new bounty = 0;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(PlayerInfo[i][pContract] > 0)
            {
                format(message1,sizeof(message1), "ID: %d  %s, Bounty: $%d.", i, GetName(i), PlayerInfo[i][pContract]);
                bounty++;
                strcat(message1, "\n");
            }
        }
    }
    if(bounty >= 1)
    ShowPlayerDialog(playerid,1337,DIALOG_STYLE_LIST,"Bounties!", message1, "Ok","Close");
    if(bounty == 0)
    SendClientMessage(playerid, -1, "No bounties at this moment.");
    return 1;
}
Any tips for the newb?
Reply
#2

I have the same problem, any ideas?
Reply
#3

pawn Код:
CMD:bounties(playerid, params[])
{
    new message1[170];
    new message2[170];
    new bounty = 0;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(PlayerInfo[i][pContract] > 0)
            {
                format(message1,sizeof(message1), "ID: %d  %s, Bounty: $%d.\n", i, GetName(i), PlayerInfo[i][pContract]);
                bounty++;
                strcat(message2, message1);
            }
        }
    }
    if(bounty >= 1)
    ShowPlayerDialog(playerid,1337,DIALOG_STYLE_LIST,"Bounties!", message2, "Ok","Close");
    if(bounty == 0)
    SendClientMessage(playerid, -1, "No bounties at this moment.");
    return 1;
}
Reply
#4

Also 170 size string won't help you. You need larger.
Reply
#5

It still wont work, even with max strings. Shows only one
Reply
#6

try this

Код:
CMD:bounties(playerid, params[])
{
    new bounty = 0,bigstring[700],string[128];
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(PlayerInfo[i][pContract] > 0)
            {
                 if(!IsPlayerNPC(i))
		 {
                       format(string,sizeof(string), "ID: %d  Player: %s, Bounty: $%d.\n", i, GetName(i), PlayerInfo[i][pContract]);
                bounty++;
                strcat(bigstring, string);
            }
        }
    }
    if(bounty > 0) ShowPlayerDialog(playerid,1337,DIALOG_STYLE_LIST,"Bounties", bigstring, "Ok","Close");
    else SendClientMessage(playerid, -1, "No bounties at this moment.");
    return 1;
}
Reply
#7

Quote:
Originally Posted by dEcooR
Посмотреть сообщение
try this
Thank you, it works!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)