SA-MP Forums Archive
Defines in Dialog title or body? - 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: Defines in Dialog title or body? (/showthread.php?tid=607026)



Defines in Dialog title or body? - Luicy. - 13.05.2016

Hey, Been some year since I left SAMP, But I'm back, creating a Roleplay server, But when I'm creating the login dialog, I want to be able to add a define called something like ServerName in the title,
PHP код:
#define ServerName New City Role Play 
PHP код:
ShowPlayerDialog(playeridD_LoginDIALOG_STYLE_INPUT"{82CAFF}" ServerName ""
Will it work like that?


Re: Defines in Dialog title or body? - BloodyRP - 13.05.2016

It will.
Cuz after u compile all #defines will be removed.

Cant explain good, cuz my english is not so good.
But answer: yes, it should work properly.


Re: Defines in Dialog title or body? - Konstantinos - 13.05.2016

Change to:
pawn Код:
#define ServerName "New City Role Play"



Re: Defines in Dialog title or body? - Gammix - 13.05.2016

This will give you an error:
Quote:

expected token: "-string end-", but found "-identifier-"

Since you don't have " " (double inverted commas) for enclosing the string whiling declaring the macro ServerName.

This would work:
pawn Код:
#define ServerName "New City Role Play"



Re: Defines in Dialog title or body? - Luicy. - 13.05.2016

Thanks the two latest answers! Was just gonna post the string end error, But saw yours answers. Thanks, Both Repped.


Re: Defines in Dialog title or body? - Luicy. - 13.05.2016

Got these errors now:
NCRP.pwn(89) : error 001: expected token: "-string end-", but found "-identifier-"
NCRP.pwn(89) : error 001: expected token: ";", but found "-string-"
NCRP.pwn(89) : warning 215: expression has no effect
NCRP.pwn(89) : warning 215: expression has no effect
NCRP.pwn(89) : warning 215: expression has no effect
NCRP.pwn(89) : error 001: expected token: ";", but found ")"
NCRP.pwn(89) : fatal error 107: too many error messages on one line


The line:

PHP код:
ShowPlayerDialog(playeridD_LoginDIALOG_STYLE_INPUT"{82CAFF}" ServerName"Welcome back to " ServerNameShorted ", " UserRPName(playerid" !\nInsert your password in order to start the fun!\n\nPassword Attempts left: " ,"Login","Quit"); 



Re: Defines in Dialog title or body? - Gammix - 13.05.2016

Removed, wrong point.


Re: Defines in Dialog title or body? - Luicy. - 13.05.2016

The Defines works, But it's about the username and login attempts.


Re: Defines in Dialog title or body? - Luicy. - 13.05.2016

Problem solved using format.


Re: Defines in Dialog title or body? - Dayrion - 13.05.2016

Quote:
Originally Posted by Meller
Посмотреть сообщение
Got these errors now:
NCRP.pwn(89) : error 001: expected token: "-string end-", but found "-identifier-"
NCRP.pwn(89) : error 001: expected token: ";", but found "-string-"
NCRP.pwn(89) : warning 215: expression has no effect
NCRP.pwn(89) : warning 215: expression has no effect
NCRP.pwn(89) : warning 215: expression has no effect
NCRP.pwn(89) : error 001: expected token: ";", but found ")"
NCRP.pwn(89) : fatal error 107: too many error messages on one line


The line:

PHP код:
ShowPlayerDialog(playeridD_LoginDIALOG_STYLE_INPUT"{82CAFF}" ServerName"Welcome back to " ServerNameShorted ", " UserRPName(playerid" !\nInsert your password in order to start the fun!\n\nPassword Attempts left: " ,"Login","Quit"); 
Why don't you do a string, more easier, like that :
PHP код:
new string[300];
format(stringsizeof(string), {82CAFF"%s Welcome back to %s, %s !\nInsert your password in order to start the fun!\n\nPassword Attempts left: %i"ServerNameServerNameShortedUserRPName(playerid), AttemptsLeft);
ShowPlayerDialog(playeridD_LoginDIALOG_STYLE_INPUTstring ,"Login","Quit"); 
You errors message come from you put comma. I mean ShowPlayerDialog is like SendClientMessage/SendClientMessageToAll, you can't put parameter in your string.
I hope this helped you.