SA-MP Forums Archive
ShowPlayerDialog() + format() problem - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: ShowPlayerDialog() + format() problem (/showthread.php?tid=255640)



ShowPlayerDialog() + format() problem [FIXED] - [SOB]Chris - 16.05.2011

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.


Re: ShowPlayerDialog() + format() problem - Jantjuh - 16.05.2011

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!


Re: ShowPlayerDialog() + format() problem - [SOB]Chris - 16.05.2011

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?


Re: ShowPlayerDialog() + format() problem - Jantjuh - 16.05.2011

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


Re: ShowPlayerDialog() + format() problem - [SOB]Chris - 16.05.2011

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 ******