Help dialog
#1

Can you help me? Name and Status Appears wrong place


PHP код:
                    if( userID != INVALID_PLAYER_ID ) {
                                
formatszDialogsizeofszDialog ),
                                
"Name\tStatus\n\
                                %s%s\t{04BD04}online{FFFFFF}\n"
szDialogname );
                            }
                            else {
                                
formatszDialogsizeofszDialog ),
                                
"Name\tStatus\n\
                                %s%s\t{D10F0F}offline{FFFFFF}\n"
szDialogname );
                            }
                            
ShowPlayerDialog(playeridDIALOG_TENANTSDIALOG_STYLE_TABLIST_HEADERS"Your tenants:"szDialog"Select""Back" ); 
Reply
#2

The problem is that you pass "szDialog" as argument and it basically sets the first text twice.

pawn Код:
// if:
format( szDialog, sizeof( szDialog ), "Name\tStatus\n\%s\t{04BD04}online{FFFFFF}\n", name );

// else:
format( szDialog, sizeof( szDialog ), "Name\tStatus\n\%s\t{D10F0F}offline{FFFFFF}\n", name );
Or you can even use ternary operator:
pawn Код:
format( szDialog, sizeof( szDialog ),
    "Name\tStatus\n\%s\t%s{FFFFFF}\n",
    name, (userID != INVALID_PLAYER_ID) ? ("{04BD04}online") : ("{D10F0F}offline"));

ShowPlayerDialog(playerid, DIALOG_TENANTS, DIALOG_STYLE_TABLIST_HEADERS, "Your tenants:", szDialog, "Select", "Back" );
Reply
#3

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
The problem is that you pass "szDialog" as argument and it basically sets the first text twice.

pawn Код:
// if:
format( szDialog, sizeof( szDialog ), "Name\tStatus\n\%s\t{04BD04}online{FFFFFF}\n", name );

// else:
format( szDialog, sizeof( szDialog ), "Name\tStatus\n\%s\t{D10F0F}offline{FFFFFF}\n", name );
Or you can even use ternary operator:
pawn Код:
format( szDialog, sizeof( szDialog ),
    "Name\tStatus\n\%s\t%s{FFFFFF}\n",
    name, (userID != INVALID_PLAYER_ID) ? ("{04BD04}online") : ("{D10F0F}offline"));

ShowPlayerDialog(playerid, DIALOG_TENANTS, DIALOG_STYLE_TABLIST_HEADERS, "Your tenants:", szDialog, "Select", "Back" );
both versions shows only the first player, not otherwise
Reply
#4

Oh, my mistake. I thought you wanted this only for one player (didn't notice the different names).

Well then, yes. You have to pass "szDialog" as argument but not to keep the text "Name\tStatus\n" in the formatting but only at the beginning.

For example:
pawn Код:
// when declaring the string:
new szDialog[150] = "Name\tStatus\n";
// change "150" to the size you use

format( szDialog, sizeof( szDialog ),
    "%s%s\t%s{FFFFFF}\n",
    szDialog, name, (userID != INVALID_PLAYER_ID) ? ("{04BD04}online") : ("{D10F0F}offline"));

ShowPlayerDialog(playerid, DIALOG_TENANTS, DIALOG_STYLE_TABLIST_HEADERS, "Your tenants:", szDialog, "Select", "Back" );
Reply
#5

Go perfect !! Thanks a lot, +1.
Reply
#6

Help me please,

pawn Код:
COMMAND:ircasa(playerid, params[]) //OK
{
    new HouseList[1000];
    SendAdminText(playerid, "/ircasa", params);
    if (APlayerData[playerid][LoggedIn] == true)
    {
        if (GetPlayerWantedLevel(playerid) < 3)
        {
            if (APlayerData[playerid][PlayerJailed] == 0)
            {
                if (GetPlayerVehicleID(playerid) == 0)
                {
                    for (new i; i < MAX_HOUSESPERPLAYER; i++)
                    {
                        if (APlayerData[playerid][Houses][i] != 0)
                            format(HouseList, sizeof(HouseList), "Nome\tLevel/Max\n%s\n%s\t%i/%i\n", HouseList, AHouseData[APlayerData[playerid][Houses][i]][HouseName], AHouseData[APlayerData[playerid][Houses][i]][HouseLevel], AHouseData[APlayerData[playerid][Houses][i]][HouseMaxLevel]);
                        else
                            format(HouseList, 1000, "%s{FFFFFF}%s{FFFFFF}\n", HouseList, "Slot vazio");
                    }
                    ShowPlayerDialog(playerid, DialogGoHome, DIALOG_STYLE_TABLIST_HEADERS, "Selecione a casa que vocк quer ir:", HouseList, "Selecionar", "Cancelar");
                }
                else
                    SendClientMessage(playerid, 0xFF0000FF, "Vocк precisa estar a pй, para ir atй a sua casa!");
            }
            else
                SendClientMessage(playerid, 0xFF0000FF, "Vocк nгo pode usar o comando /irparacasa quando estб preso!");
        }
        else
            SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}Vocк nгo pode usar o comando /irparacasa quando estб procurado!");
    }
    else
        return 0;
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)