AlliedModders

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

--kml-- 05-29-2009 08:47

ENUM :O
 
ENUM :O


well i am confused with the enum
can explain the use and what it is


Quote:

and yes i've use the search button and came with 500 threads.
but didnt found any explanation .

Bugsy 05-29-2009 09:12

Re: ENUM :O
 
Many features\elements of Small are not exclusive to the language. If you are ever unsure of anything and cannot find it in an AMX-X search, don't hesitate to try Google. This will 9 out of 10 times answer your question as long as you are not searching something related to the functions/systems used in HL scripting. In this particular case, enum is widely used in many programming languages so you will get many hits when you search the web.

http://en.wikipedia.org/wiki/Enumerated_type
http://www.cprogramming.com/tutorial/enum.html
http://java.sun.com/docs/books/tutor...vaOO/enum.html

--kml-- 05-29-2009 09:30

Re: ENUM :O
 
i've click 3 of those.
didnt even understand LOL

Bugsy 05-29-2009 09:42

Re: ENUM :O
 
You clicked them but did you actually read and try to absorb what they say? You can't expect to be spoon-fed if you are trying to learn how to program on your own (no schooling\books).

BFK_GoNER 05-31-2009 11:11

Re: ENUM :O
 
For instance, you want to define a set of constants belonging to the same group. You could do it this way:

PHP Code:

// Weapon constants:
#define WEAPON_KNIFE     10
#define WEAPON_DEAGLE   20
#define WEAPON_AK47      30
#define WEAPON_AWP       40
#define WEAPON_FLASH    50 

or you could use enum:

PHP Code:

enum (+=10)
{
      
WEAPON_KNIFE 10,
      
WEAPON_DEAGLE,     // will be equal to 20
      
WEAPON_AK47,        // will be equal to 30
      
WEAPON_AWP,        // ... and so on
      
WEAPON_FLASH       // ...




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

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