AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Constants and Enum (https://forums.alliedmods.net/showthread.php?t=156510)

marquezs 05-07-2011 17:39

Constants and Enum
 
Is it possible to associate a constant to a enum? How do I do it?

For example
PHP Code:

enum _:other {
        
AAA,
        
BBB,
        
ZZZ
}

new const 
some[][] = { 
        
"XXX",
        
"YYY",
        
"ZZZ"
}

function()
{
    
some[AAA// This would call the value inside the constant array


Thanks

nnajko 05-07-2011 17:56

Re: Constants and Enum
 
PHP Code:

enum _:PRINTS 

         
PRINT1
         
PRINT2
         
PRINT3 


new const 
szPrint[PRINTS][] = 
{
         
"Oh My God!",  
         
"Hehe"
         
"Santa Claus" 


public 
PrintToPlayer(id

         
client_print(idprint_chat"%s"szPrint[PRINT1]);



marquezs 05-07-2011 18:06

Re: Constants and Enum
 
Oh, now I see the problem, I was doing it correctly, but one function I had created was using it wrongly and was always giving me the same error.

Thanks


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

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