Raised This Month: $ Target: $400
 0% 

Converting enum elements


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-08-2020 , 16:27   Re: Converting enum elements
Reply With Quote #1

The enumerator members are only integer constants, the name of the variable cannot be converted to a string, to my knowledge at least. You'd need to size an array using the enumerator name and place the items in the array in the same order.
PHP Code:
enum Colors 
{
    
Red,
    
Green,
    
Blue,
    
Purple,
    
Yellow
}

new 
cColorStringsColors ][] = 
{
    
"Red",
    
"Green",
    
"Blue",
    
"Purple",
    
"Yellow"
};

server_print"The sun is %s" cColorStringsYellow ] ); 
__________________

Last edited by Bugsy; 06-08-2020 at 16:41.
Bugsy 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 17:07.


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