SA-MP Forums Archive
#define - 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: #define (/showthread.php?tid=452164)



#define - Andriensis - 20.07.2013

Okay, so..
I'm having a little problem.
I was trying to do something like this:
#define SPAWN1_NAME Los Santos
#define SPAWN2_NAME Las Venturas

ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,"Spa wn"," SPAWN1_NAME \n SPAWN2_NAME","Ok","");

but it doesn't work.. instead of "Los Santos" or "Las Venturas" I got a dialog with "SPAWN1_NAME" and "SPAWN2_NAME".

Thanks for the help.


Re: #define - NeroX98 - 20.07.2013

pawn Code:
#define SPAWN1_NAME "Los Santos"
#define SPAWN2_NAME "Las Venturas"
I'm not sure that this would work, but try


Re: #define - mahdi499 - 20.07.2013

Because that isn't how it works it should be
pawn Code:
ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,"Spawn"," " + SPAWN1_NAME +"\n" + "" + SPAWN2_NAME....



Respuesta: #define - Xabi - 20.07.2013

pawn Code:
#define SPAWN1_NAME "Los Santos"
#define SPAWN2_NAME "Las Venturas"

new string[128];
format(string, sizeof(string), "%s\n%s", SPAWN1_NAME, SPAWN2_NAME);
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Spawn", string, "Ok", "");
That should work.


Re: #define - GWMPT - 20.07.2013

Instead of what you have, try this:
pawn Code:
// top
#define SPAWN1_NAME "Los Santos"
#define SPAWN2_NAME "Las Venturas"
// ShowPlayerDialog function
ShowPlayerDialog(playerid, 1 DIALOG_STYLE_LIST, "Spawn", SPAWN1_NAME"\n"SPAWN2_NAME, "Ok", "");
Quote:
Originally Posted by mahdi499
View Post
Because that isn't how it works it should be
pawn Code:
ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,"Spawn"," " + SPAWN1_NAME +"\n" + "" + SPAWN2_NAME....
This isn't squirrel / javascript


Re: #define - Misiur - 20.07.2013

Not quite guys.

pawn Code:
#define SPAWN1_NAME "Los Santos"
#define SPAWN2_NAME "Las Venturas"

ShowPlayerDialog(0,1,DIALOG_STYLE_LIST,"Spawn","" SPAWN1_NAME "\n " SPAWN2_NAME "","Ok","");
#e: The better solution is @up


Re: #define - mahdi499 - 20.07.2013

Quote:
Originally Posted by Kikito
View Post

This isn't squirrel / javascript
yeah i realized wrong scripting language,sorry scumbag brain