ShowPlayerDialog() + format() problem
#1

Hi! i have just a question.
here my script
pawn Код:
new string[128];
format(string,sizeof(string),"%s",Text_GetPlayerText("WEAPSSLOTS",playerid));
ShowPlayerDialog(playerid, WEAPSMENU, DIALOG_STYLE_LIST, Text_GetPlayerText("WEAPSINFO",playerid), string, "Ok", "Esc");
or
pawn Код:
ShowPlayerDialog(playerid, WEAPSMENU, DIALOG_STYLE_LIST, Text_GetPlayerText("WEAPSINFO",playerid), Text_GetPlayerText("WEAPSSLOTS",playerid), "Ok", "Esc");
(I try of 2 ways)


TextGetPlayerText reads one .txt file and returns a line of text.
here the line in the .txt
Код:
WEAPSSLOTS = Armas de Mano [Espacio 1]\nEscopetas [Espacio 2]\nMetralletas [Espacio 3]\nSubfusiles [Espacio 4]\nRifles [Espacio 5]
the problem I have is that the result of showplayerdialog is.
Код:
Armas de Mano [Espacio 1]\nEscopetas [Espacio 2]\nMetralletas [Espacio 3]\nSubfusiles [Espacio 4]\nRifles [Espacio 5]
and should be

Код:
Armas de Mano [Espacio 1]
Escopetas [Espacio 2]
Metralletas [Espacio 3]
Subfusiles [Espacio 4]
Rifles [Espacio 5]
I hope you have understood, thanks for your attention.
Reply
#2

Hey,

try:

Код:
WEAPSSLOTS = Armas de Mano [Espacio 1]\r\nEscopetas [Espacio 2]\r\nMetralletas [Espacio 3]\r\nSubfusiles [Espacio 4]\r\nRifles [Espacio 5]
goodluck!
Reply
#3

hey thanks for the answer amm the result is the same thing only change the \n for \r\
Код:
Armas de Mano [Espacio 1]\r\Escopetas [Espacio 2]\r\Metralletas [Espacio 3]\r\Subfusiles [Espacio 4]\r\Rifles [Espacio 5]
anybody knows why?
Reply
#4

Quote:
Originally Posted by [SOB]Chris
Посмотреть сообщение
hey thanks for the answer amm the result is the same thing only change the \n for \r\
Код:
Armas de Mano [Espacio 1]\r\Escopetas [Espacio 2]\r\Metralletas [Espacio 3]\r\Subfusiles [Espacio 4]\r\Rifles [Espacio 5]
anybody knows why?
but did you try: \r AND \n?? So: \r\n
Reply
#5

thanks for the anwser Jantjuh but is the same ._. haha

yes ****** im using your library (which is amazing by the way)
****** forgive i dont understand how to use Text_DoNL (string []) this returns a string or somethig, or just call it?
on top of the script
pawn Код:
stock Text_DoNL(string[])
{
    for (new i = 0, j = strlen (string); i != j; ++i)
    {
        if (string[i] == '\\' && string[i + 1] == 'n') string[i] = '\r', string[i + 1] = '\n';
    }
}
pawn Код:
ShowPlayerDialog(playerid, WEAPSMENU, DIALOG_STYLE_LIST, Text_GetPlayerText("WEAPSINFO",playerid), Text_DoNL(Text_GetPlayerText("WEAPSSLOTS",playerid)), "Ok", "Esc");
its okay?? xd

----------------------------------------------------------------------------------
Edit works now, ignore this message haha thanks again ******
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)