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

Multi-dimensional arrays must be fully initialized (compile)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 05-17-2010 , 15:11   Multi-dimensional arrays must be fully initialized (compile)
Reply With Quote #1

lol I don't get whats wrong here?

PHP Code:
#define MAX_ZOMBIE_CLASSES 2

new const String:RandomModels[MAX_ZOMBIE_CLASSES][][] = 
{
    { 
"models/player/zh/zh_zombie003""models/player/slow/l4d/hot_ass_zombie/slow_v2""models/player/slow/zombie_package/slow_1" },
    { 
"models/player/slow/amberlyn/re5/dog/slow" }
}; 
__________________

Last edited by xbatista; 05-17-2010 at 15:14.
xbatista is offline
Send a message via Skype™ to xbatista
dirka_dirka
Veteran Member
Join Date: Nov 2009
Old 05-17-2010 , 15:47   Re: Multi-dimensional arrays must be fully initialized (compile)
Reply With Quote #2

you have 3 strings in the [0] but only 1 string in [1]
dirka_dirka is offline
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 05-18-2010 , 08:39   Re: Multi-dimensional arrays must be fully initialized (compile)
Reply With Quote #3

ahh fail ,thanks
__________________
xbatista is offline
Send a message via Skype™ to xbatista
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 05-18-2010 , 10:42   Re: Multi-dimensional arrays must be fully initialized (compile)
Reply With Quote #4

Is it possible somehow register this like my method without compile errors :
PHP Code:
new const String:RandomModels[MAX_ZOMBIE_CLASSES][][] =  

    { 
"models/player/zh/zh_zombie003""models/player/slow/l4d/hot_ass_zombie/slow_v2""models/player/slow/zombie_package/slow_1" }, 
    { 
"models/player/slow/amberlyn/re5/dog/slow" 
}; 
Because I don't want register it like this

PHP Code:
"models/player/slow/amberlyn/re5/dog/slow""""" 
__________________
xbatista is offline
Send a message via Skype™ to xbatista
LumiStance
AlliedModders Donor
Join Date: Jan 2009
Location: Northern California
Old 05-18-2010 , 14:17   Re: Multi-dimensional arrays must be fully initialized (compile)
Reply With Quote #5

Do you really need a 2D jagged array of strings?

What about a separate array for each class?
__________________

Last edited by LumiStance; 05-18-2010 at 14:32.
LumiStance is offline
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 05-18-2010 , 14:53   Re: Multi-dimensional arrays must be fully initialized (compile)
Reply With Quote #6

I don't want separate
Yes I want 2D, so how ? :/
__________________
xbatista is offline
Send a message via Skype™ to xbatista
API
Veteran Member
Join Date: May 2006
Old 05-18-2010 , 19:55   Re: Multi-dimensional arrays must be fully initialized (compile)
Reply With Quote #7

xbatista, SourcePawn isn't PHP. In order to correctly allocate arrays, the size must be determined upon compile. Since the array has three entries in the first index, the second index must follow suit. If you want, you can use ADT arrays if you want to be strict about conserving RAM.
__________________
API is offline
Send a message via AIM to API
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 13:53.


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