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



format and #define question - toby` - 11.03.2010

hi, what am i doing wrong?

i want the "ALTERNATIVE_NAME" to return mike`

Код:
#define FirstName "mike"
#define ALTERNATIVE_NAME return format(ALTERNATIVE_NAME,sizeof(ALTERNATIVE_NAME), "%s%c", FirstName,"'");



Re: format and #define question - StreetGT - 11.03.2010

? you want only players in your server with Firstname_Lastname?


Re: format and #define question - toby` - 11.03.2010

Quote:
Originally Posted by [69
StreetGT ]
? you want only players in your server with Firstname_Lastname?
No, i am asking about the syntax and structure of the code, not an inquisition on what i want it for :/



Re: format and #define question - adsy - 11.03.2010

i dont believe you need the return

what you are doing is setting ALTERNATIVE_NAME to basically run the code after it


so later on in your script you would do:

Код:
ALTERNATIVE_NAME
SendClientMessage(playerid, 0x00000000, DIFFERENT_VARIABLE);
your define cannot use itself to replace the code but it can use it

example:
Код:
new string[128];
#define ALTERNATIVE_NAME format(string,sizeof(string), "%s%c", FirstName,"'");
later in script

Код:
ALTERNATIVE_NAME
SendClientMessage(playerid, 0x00000000, string);



Re: format and #define question - toby` - 12.03.2010

worked a treat,
thankyou adsy