Raised This Month: $ Target: $400
 0% 

Enums & 2D array


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Natsheh
Veteran Member
Join Date: Sep 2012
Old 07-15-2017 , 08:40   Enums & 2D array
Reply With Quote #1

PHP Code:
enum COLORS_VAR
{
    
COLOR_NAME[32],
    
Float:COLOR_FVALUE[3],
    
Float:COLOR_FRENDERING
}

new const 
COLORS_DATA[][COLORS_VAR] = {
    { 
"Red", {200.0000.0000.0}, 100.0 },
    { 
"Red Orange", {255.0083.0073.0}, 135.0 },
    { 
"Orange", {255.0117.0056.0}, 140.0 }, 
    { 
"Yellow Orange", {255.0174.0066.0}, 120.0 }, 
    { 
"Peach", {255.0207.0171.0}, 140.0 }, 
    { 
"Yellow", {252.0232.0131.0}, 125.0 },
    { 
"Dark Lemon Lime", { 135.0200.0020.0 }, 115.0 },
    { 
"Lemon Yellow", {254.0254.0034.0}, 100.0 },
    { 
"Jungle Green", {059.0176.0143.0}, 125.0 },
    { 
"Yellow Green", {197.0227.0132.0}, 135.0 },
    { 
"Light Sea Green", {050.0175.0070.0}, 130.0 },
    { 
"Green", {000.0150.0000.0}, 100.0 },
    { 
"Aquamarine", {120.0219.0226.0}, 125.0 },
    { 
"Baby Blue", {135.0206.0235.0}, 150.0 },
    { 
"Charged Blue", {055.0015.0220.0}, 125.0 }, 
    { 
"Sky Blue", {128.0218.0235.0}, 090.0 },
    { 
"Blue", {000.0000.0255.0}, 075.0 },
    { 
"Violet", {146.0110.0174.0}, 175.0 },
    { 
"Dogwood Rose", {220.0050.0200.0}, 135.0 },
    { 
"Hot Pink", {255.0105.0180.0}, 150.0 },
    { 
"Magenta", {246.0100.0175.0}, 175.0 },
    { 
"Mahogany", {205.0074.0076.0}, 140.0 },
    { 
"Tan", {250.0167.0108.0}, 140.0 },
    { 
"Light Brown", {234.0126.0093.0}, 140.0 },
    { 
"Brown", {180.0103.0077.0}, 165.0 },
    { 
"Gray", {149.0145.0140.0}, 175.0 },
    { 
"Black", {000.0000.0000.0}, 125.0 },
    { 
"White", {255.0255.0255.0}, 125.0 }
}

public 
call_color_menu()
{
      
display_menu(id"MENU_ID""TITLE"COLORS_DATA[][COLOR_NAME], etc....) // this is line 512....
}

display_menu(id, const menu_name[], const title[], const menu[][], const msize, const colornum[3]="\r", const ikeys=MENU_KEYSmaxperpage=5page=0)
{
      
// code etc....

i get fail to compile....

error log:-

Code:
Error: Invalid expression, assumed zero on line 521

isnt this a 2D array >> COLORS_DATA[][COLOR_NAME] <<
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
eyal282
Veteran Member
Join Date: Aug 2011
Old 07-15-2017 , 08:42   Re: Enums & 2D array
Reply With Quote #2

Quote:
Originally Posted by Natsheh View Post
PHP Code:
enum COLORS_VAR
{
    
COLOR_NAME[32],
    
Float:COLOR_FVALUE[3],
    
Float:COLOR_FRENDERING
}

new const 
COLORS_DATA[][COLORS_VAR] = {
    { 
"Red", {200.0000.0000.0}, 100.0 },
    { 
"Red Orange", {255.0083.0073.0}, 135.0 },
    { 
"Orange", {255.0117.0056.0}, 140.0 }, 
    { 
"Yellow Orange", {255.0174.0066.0}, 120.0 }, 
    { 
"Peach", {255.0207.0171.0}, 140.0 }, 
    { 
"Yellow", {252.0232.0131.0}, 125.0 },
    { 
"Dark Lemon Lime", { 135.0200.0020.0 }, 115.0 },
    { 
"Lemon Yellow", {254.0254.0034.0}, 100.0 },
    { 
"Jungle Green", {059.0176.0143.0}, 125.0 },
    { 
"Yellow Green", {197.0227.0132.0}, 135.0 },
    { 
"Light Sea Green", {050.0175.0070.0}, 130.0 },
    { 
"Green", {000.0150.0000.0}, 100.0 },
    { 
"Aquamarine", {120.0219.0226.0}, 125.0 },
    { 
"Baby Blue", {135.0206.0235.0}, 150.0 },
    { 
"Charged Blue", {055.0015.0220.0}, 125.0 }, 
    { 
"Sky Blue", {128.0218.0235.0}, 090.0 },
    { 
"Blue", {000.0000.0255.0}, 075.0 },
    { 
"Violet", {146.0110.0174.0}, 175.0 },
    { 
"Dogwood Rose", {220.0050.0200.0}, 135.0 },
    { 
"Hot Pink", {255.0105.0180.0}, 150.0 },
    { 
"Magenta", {246.0100.0175.0}, 175.0 },
    { 
"Mahogany", {205.0074.0076.0}, 140.0 },
    { 
"Tan", {250.0167.0108.0}, 140.0 },
    { 
"Light Brown", {234.0126.0093.0}, 140.0 },
    { 
"Brown", {180.0103.0077.0}, 165.0 },
    { 
"Gray", {149.0145.0140.0}, 175.0 },
    { 
"Black", {000.0000.0000.0}, 125.0 },
    { 
"White", {255.0255.0255.0}, 125.0 }
}

public 
call_color_menu()
{
      
display_menu(id"MENU_ID""TITLE"COLORS_DATA[][COLOR_NAME], etc....) // this is line 512....
}

display_menu(id, const menu_name[], const title[], const menu[][], const msize, const colornum[3]="\r", const ikeys=MENU_KEYSmaxperpage=5page=0)
{
      
// code etc....

i get fail to compile....

error log:-

Code:
Error: Invalid expression, assumed zero on line 521

isnt this a 2D array >> COLORS_DATA[][COLOR_NAME] <<

Unsure about the rest of the code but it doesn't make sense. You are inputting something probably problematic. Try inputting in your call_color_menu COLORS_VAR ( the enumeration )
eyal282 is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 07-15-2017 , 09:12   Re: Enums & 2D array
Reply With Quote #3

im trying to output the color name from ( the 2D array ) and insert it in the display_menu function which require a 2D array ( const menu[][] ) the problem is with my procedure.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 07-15-2017 , 11:54   Re: Enums & 2D array
Reply With Quote #4

PHP Code:
COLORS_DATA[][COLOR_NAME
When accessing it, you have to index the first dimension. It can't just be [].
klippy is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 07-15-2017 , 14:17   Re: Enums & 2D array
Reply With Quote #5

Quote:
Originally Posted by KliPPy View Post
PHP Code:
COLORS_DATA[][COLOR_NAME
When accessing it, you have to index the first dimension. It can't just be [].
Im trying to get all the colors name into 2d array called menu[][] how should i do this?

And it actually can be in some conditions..when u passing it into a 2d array param.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 07-16-2017 at 12:02.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-16-2017 , 00:22   Re: Enums & 2D array
Reply With Quote #6

Loop through your array (using the first index) and use copy() to get it into the new array.
__________________
fysiks is online now
Reply


Thread Tools
Display Modes

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 23:09.


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