SA-MP Forums Archive
Help dialog - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help dialog (/showthread.php?tid=573923)



Help dialog - Edw - 11.05.2015

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" ); 



Re: Help dialog - Konstantinos - 11.05.2015

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" );



Re: Help dialog - Edw - 11.05.2015

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


Re: Help dialog - Konstantinos - 11.05.2015

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" );



Re: Help dialog - Edw - 11.05.2015

Go perfect !! Thanks a lot, +1.


Re: Help dialog - JoaoMonteiro452 - 14.06.2015

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;
}