Raised This Month: $32 Target: $400
 8% 

Constants and Enum


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
marquezs
Member
Join Date: Jun 2010
Old 05-07-2011 , 17:39   Constants and Enum
Reply With Quote #1

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
marquezs is offline
nnajko
Senior Member
Join Date: May 2009
Location: Sweden
Old 05-07-2011 , 17:56   Re: Constants and Enum
Reply With Quote #2

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]);

nnajko is offline
marquezs
Member
Join Date: Jun 2010
Old 05-07-2011 , 18:06   Re: Constants and Enum
Reply With Quote #3

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
marquezs is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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