Raised This Month: $ Target: $400
 0% 

Solved error 052: multi-dimensional arrays must be fully initialized


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-09-2022 , 19:56   Re: error 052: multi-dimensional arrays must be fully initialized
Reply With Quote #2

All of the variables defined in your RegisterData enum are integers, not strings. Strings themselves are arrays so your enum needs to have the extra dimension for the length of the string (plus 1).

Here is an example of properly storing strings with enums (including examples for using it as a global dataset and as player-specific datasets):

PHP Code:
enum _:MyEnum {
    
STRING1[32],
    
STRING2[32]
}

// Save one global set of data
g_GlobalData[MyEnum] = {
    
"Hello",
    
"World"
}

server_print("%s"g_GlobalData[STRING1]) // Get and use "Hello"


// Save data per-player
new g_UserData[MAXPLAYERS+1][MyEnum// Data gets populated as needed

server_print("%s"g_UserData[id][STRING1]) // Get and use STRING1 for specific player 
I'm not entirely sure what you're trying to do based on your post. What you claim solves your problems doesn't make much sense to me. I'm quite sure that g_DataKeys[RD_DeadSound][0] would reference just the first character of the string.
__________________

Last edited by fysiks; 12-09-2022 at 20:23.
fysiks is offline
 



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 15:38.


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