SA-MP Forums Archive
dialog error - 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: dialog error (/showthread.php?tid=623625)



dialog error - GabiXx - 02.12.2016

i try this
PHP код:
CMD:jobs(playeridparams[])
{
   
ShowPlayerDialog(playeridDIALOG_JOBDIALOG_STYLE_LIST"Lista de job-uri""Fisher\n\Arms Dealer\n\Detective\n\Mechanic\n\Pizza Boy\n\Bus Driver\n\Trucker\n\Drug Dealer\n\Garbage Man\n\Farmer\n","Alege","Inchide");
   return 
1;

and i get invalid character constant


Re: dialog error - Freaksken - 02.12.2016

Remove the \ after every \n


Re: dialog error - GabiXx - 02.12.2016

Same


Re: dialog error - GabiXx - 02.12.2016

I resolved using this:
PHP код:
CMD:jobs(playeridparams[])
{
   
ShowPlayerDialog(playeridDIALOG_JOBDIALOG_STYLE_LIST"Lista de job-uri",
   
"Fisher\n\
   Arms Dealer\n\
   Detective\n\
   Mechanic\n\
   Pizza Boy\n\
   Bus Driver\n\
   Trucker\n\
   Drug Dealer\n\
   Garbage Man\n\
   Farmer\n"
,
   
"Alege","Inchide");
   return 
1;




Re: dialog error - Freaksken - 03.12.2016

Again, you don't need the extra \ after each \n.
Whenever you use a \n the script knows that it should put the next characters on a new line.
Whenever you use a \t the script will insert a tab.
And so on ...

In other words, the \ has a special meaning.
Don't use it alone and don't use an unknown combination, because the script won't know what to replace it with.
You used \n and the script knows that it should put the next characters on a new line.
You also used things like \Detective but the script doesn't know what \Detective should be replaced with.

See this wiki page, to learn about escape characters and this wiki page for a list of escape codes.

PS: Also, just saying things like "same" or "it still doesn't work", helps nobody. Add your edited code next time.
Also, just googling the error avoids answering the same question multiple times: click.


Re: dialog error - Vince - 03.12.2016

Quote:
Originally Posted by Freaksken
Посмотреть сообщение
Again, you don't need the extra \ after each \n.
In this case you do because now that extra backslash signals the compiler that the string continues on the next line. I agree with everything else, though.


Re: dialog error - Freaksken - 03.12.2016

Quote:
Originally Posted by Vince
Посмотреть сообщение
In this case you do because now that extra backslash signals the compiler that the string continues on the next line. I agree with everything else, though.
Yes indeed, otherwise the compiler would have complained again.
What I meant was that I don't think putting everything on a new line and saying oh now it works would help him understand what he did wrong the first time.
I tried to make him fix his first attempt, rather than explaining why his second attempt magically did work, because the "rules" changed somewhat.