Raised This Month: $51 Target: $400
 12% 

[TUT] Enumerations (enum)


Post New Thread Reply   
 
Thread Tools Display Modes
Rirre
Veteran Member
Join Date: Nov 2006
Old 07-30-2015 , 05:25   Re: [TUT] Enumerations (enum)
Reply With Quote #111

Appreciate if someone can help me with this one since I'm so impatient right now.
Code:
enum _:EntInfo {     Model[32],     Name[32],
    Int
} new const g_szModelList[][EntInfo] = {
    { "models/player.mdl" , "Player", "0" }, // warning 228: length of initialler exceeds size of the enum field
                                           // error 018: initialization data exceeds declared size
} new int[2]; for( new i; i < sizeof g_szModelList; i++ ) {     switch( g_szModelList[i][Int] )     {         case 0: int = {255, 0};         case 1: int = {0, 255};         case 2: int = {255, 255};     }     set_hudmessage(int[0], int[1], 0, -1.0, 0.35, 0, 6.0, 12.0, 0.1, 0.2, -1); }

Last edited by Rirre; 07-30-2015 at 05:27.
Rirre is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 07-30-2015 , 05:30   Re: [TUT] Enumerations (enum)
Reply With Quote #112

In the enum you declare an int, but in g_szModelList you put a string. So "0" should be 0. Or make Int an array too.
__________________

Last edited by HamletEagle; 07-30-2015 at 05:35.
HamletEagle is online now
Rirre
Veteran Member
Join Date: Nov 2006
Old 07-30-2015 , 06:59   Re: [TUT] Enumerations (enum)
Reply With Quote #113

Quote:
Originally Posted by HamletEagle View Post
In the enum you declare an int, but in g_szModelList you put a string. So "0" should be 0. Or make Int an array too.
Omfg, forgot about the quotes around 0.
Thanks, now it's working.
Rirre is offline
IEcliPsEI95
Junior Member
Join Date: Jul 2011
Location: Romania
Old 08-09-2015 , 07:21   Re: [TUT] Enumerations (enum)
Reply With Quote #114

Can anyone help me with this one, if I done it correctly?

PHP Code:
enum _:days{
   
freeday = -1,
   
sunday,
   
monday,
   
tuesday,
   
wensday,
   
thirsday,
   
friday,
   
saturday
}

new 
today freeday //game starts in freeday to allow players to connect

new bool:wasThisDay[days//this will be an array of bools 


... somewhere in the code
if(bool:wasThisDay[thirsday] == false)
{
    
wasThisDay[thirsday] = true
    today 
thirsday 

it's ok to make it like this, wanted to associate numers to defines just like in c
IEcliPsEI95 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:12.


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