AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Defines (https://forums.alliedmods.net/showthread.php?t=132598)

mysticssjgoku4 07-16-2010 16:41

Defines
 
Code:
#define PLUGIN  "NSA-CO-General" #if defined PLUGIN "Yo" new LOL = 0 #endif

I only want the variable to be declared if the define equals "Yo". Is this possible?

YamiKaitou 07-16-2010 16:45

Re: Defines
 
#if PLUGIN == "Yo"

mysticssjgoku4 07-16-2010 16:48

Re: Defines
 
Quote:

error 033: array must be indexed (variable "-unknown-")
Weird O_o

Below, this works, because it is an integer, but I don't know if you can compare strings...anyone?
Code:
#define LOL 2 #if LOL == 1 new LOL1 = 0; #endif #if LOL == 2 new LOL2 = 0; #endif

PattyBiena 07-16-2010 17:15

Re: Defines
 
Use ()

mysticssjgoku4 07-16-2010 17:35

Re: Defines
 
What do you mean? None of these work.
Code:
#if (PLUGIN == "Yo") new LOL = 0 #endif #if (PLUGIN) == "Yo" new LOL = 0 #endif #if PLUGIN == ("Yo") new LOL = 0 #endif #if PLUGIN ("Yo") new LOL = 0 #endif if (PLUGIN) "Yo" new LOL = 0 #endif

ot_207 07-17-2010 15:20

Re: Defines
 
Quote:

Originally Posted by mysticssjgoku4 (Post 1241762)
What do you mean? None of these work.
Code:
#if (PLUGIN == "Yo") new LOL = 0 #endif #if (PLUGIN) == "Yo" new LOL = 0 #endif #if PLUGIN == ("Yo") new LOL = 0 #endif #if PLUGIN ("Yo") new LOL = 0 #endif if (PLUGIN) "Yo" new LOL = 0 #endif

I do not think that it is possible to compare defined strings because it is a useless feature. You only need int values for comparison.


All times are GMT -4. The time now is 07:07.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.