dialog error
#1

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
Reply
#2

Remove the \ after every \n
Reply
#3

Same
Reply
#4

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;

Reply
#5

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.
Reply
#6

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.
Reply
#7

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)