SA-MP Forums Archive
Define variable - 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 variable (/showthread.php?tid=334100)



Define variable - Nightmare12 - 13.04.2012

Hi, i have question how to define variable, i give example what i want

#define VER "getdate()"

Of course i have error and PAWNO crashes... I want make in define variable with date, it possible to do it?


Re: Define variable - zSuYaNw - 13.04.2012

pawn Код:
#define VER getdate
try this =)

pawn Код:
VER(Year, Month, Day);



Re: Define variable - Ricop522 - 13.04.2012

pawn Код:
stock getDateEx() {
    new year, d, mon;
    getdate(year, d, mon);
    return year,d,mon;
}

//
#define VER getdate

// Example:

#define SCM SendClientMessage
// With params

#define SCM(%0, %1, %2) SendClientMessage(%0, %1, %2) // playerid, color, message
// #define VER(%0, %1, %2) getdate(%0, %1, %2)



Re: Define variable - Nightmare12 - 14.04.2012

Iwant something in effect:

SetGameModeText("GM 2012:04:14");
But of course with variable
SetGameModeText(""VER"");

i have like i too write define

#define VER "GM getdate()"


Re: Define variable - Sasino97 - 14.04.2012

new string[64];
new d, m, y;
getdate(d, m, y);
format(string, 64, "%d.%d.%d gm name", d, m, y);
SetGameModeText(string);


Sorry, I'm using q cellphone for wriing this


Re: Define variable - Nightmare12 - 14.04.2012

Thanks, is possibility to make this in define? Because i use def in other places too,