Raised This Month: $ Target: $400
 0% 

help with "enum"


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
reinert
Veteran Member
Join Date: Feb 2007
Old 10-07-2010 , 05:57   help with "enum"
Reply With Quote #1

Why the hell names doesn't show up on my menu ???

here is the code:

PHP Code:
new TYPE:mode[64];
enum TYPE
{
    
NONE 0,
    NEW = 
1,
    
OLD 2
}

client_connect(id){
     
TYPE:mode[id] = NONE;
}

new 
mode1[256]
formatex(mode1255"You are [ %s ]"TYPE:mode[id])
menu_additem(menumode1"1"0); 

Ir show me like

You are [ ]



where is the problem ??
reinert is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-07-2010 , 06:14   Re: help with "enum"
Reply With Quote #2

The problem is you don't now what you are going.

- Can you tell me where you retrieve the name?
- The array should have 2 dimensions. [ id ][ name ]
- What is the point to tag an array of string with such enum?
__________________
Arkshine is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 10-07-2010 , 19:36   Re: help with "enum"
Reply With Quote #3

The code is unnecessarily tagging the mode variable with TYPE: all over. You also cannot format the names inside an enumeration as a string.

Example similar to what I assume you were trying to do:
Code:
enum Type {     NONE = 0,     NEW = 1,     OLD = 2 } new const TypeNames[Type][5] = {     "None",     "New",     "Old" } new Type:Mode[33] public client_connect( id ) {     Mode[id] = NONE } func() {     new str[64]     formatex( str, 63, "You are [ %s ]", TypeNames[Mode[id]] )         // ... }
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
reinert
Veteran Member
Join Date: Feb 2007
Old 10-08-2010 , 05:26   Re: help with "enum"
Reply With Quote #4

Thank you!
reinert 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 10:16.


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