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



#define in YCMD - GospodinX - 27.07.2018

Hi guys,

Is possible to use DEFINE for YCMD commands?

#DEFINE ADMIN "makeadmin"

Code:
YCMD:ADMIN(playerid,params[],help)
So it need to be ycmd:makeadmin .. (I know that this don't will work,but is there any way to do it..)


Re: #define in YCMD - GospodinX - 27.07.2018

Quote:
Originally Posted by Y_Less
View Post
No, but why would you want to? What does that gain you over naming the command normally?
I use one script on two different server.For example:

Code:
#define CROATIA 1
#define BOSNIA 0

#if CROATIA == 1
#define ADMIN "makeadmin"
#else 
#define ADMIN "adminmake"
#endif
(It's just example,so when i compile with #define Croatia 1 i get different command names then #define bosnia 1...)


Re: #define in YCMD - GospodinX - 27.07.2018

Quote:
Originally Posted by Y_Less
View Post
Then:

#define @yC_ADMIN @yC_realname

Iirc
Thank you very much!

I have last question abotu define.
Is possible to use define in define

For example

Code:
#define TEST "are"
#define MESSAGE "How  "#TEST" you ?"
printf(MESSAGE);
need to give:
How are you?


Re: #define in YCMD - Gammix - 27.07.2018

PHP Code:
#define ADMIN_CMD(%1) YCMD:makeadmin(%1)
ADMIN_CMD(playeridparams[]) {
    return 
1;




Re: #define in YCMD - GospodinX - 27.07.2018

Quote:
Originally Posted by Gammix
View Post
PHP Code:
#define ADMIN_CMD(%1) YCMD:makeadmin(%1)
ADMIN_CMD(playeridparams[]) {
    return 
1;

Thank you very much Gammix,this works

Y_Less method also work,but with one define...When i make more defines my script don't want compile(I don't get any errors,just it don't want to compile..)