Raised This Month: $ Target: $400
 0% 

Initialization data exceeds declared size


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Rexonspix
Junior Member
Join Date: Oct 2005
Location: Denmark
Old 08-01-2009 , 08:11   Initialization data exceeds declared size
Reply With Quote #1

Hello.

I'm getting this error "Initialization data exceeds declared size", and I can't figure out, what I am doing wrong.

First I have this declared:
Code:
new jobPoliceRank[7] = { "Officer", "Detective", "Sergeant", "Lieutenant", "Major", "Inspector", "Sheriff" };
and later I have:
Code:
new rank[256];

rank[255] = jobPoliceRank[1];
Rexonspix is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-01-2009 , 09:18   Re: Initialization data exceeds declared size
Reply With Quote #2

- jobPoliceRank[7]-> jobPoliceRank[7][]
- Use copy()
__________________
Arkshine is offline
Rexonspix
Junior Member
Join Date: Oct 2005
Location: Denmark
Old 08-01-2009 , 12:07   Re: Initialization data exceeds declared size
Reply With Quote #3

Now I get the error: "Must be assigned to an array" on the code:
Code:
rank[255] = jobPoliceRank[1];
Rexonspix is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 08-01-2009 , 12:15   Re: Initialization data exceeds declared size
Reply With Quote #4

Quote:
Originally Posted by Rexonspix View Post
Now I get the error: "Must be assigned to an array" on the code:
Code:
rank[255] = jobPoliceRank[1];
Quote:
Originally Posted by Arkshine View Post
- Use copy()

PHP Code:
//A little easier to read
new jobPoliceRank[][] = 

    
"Officer"
    
"Detective"
    
"Sergeant"
    
"Lieutenant"
    
"Major"
    
"Inspector"
    
"Sheriff" 
};

new 
szRank11 ];

//the_rank_index should be 0 through 6. 0 = "Officer", 6 = "Sherriff"
copyszRank 10 jobPoliceRankthe_rank_index ] ); 
Show us what you are trying to do because you may not need to make a copy of the string, you can probably just use the original.
__________________

Last edited by Bugsy; 08-01-2009 at 12:17.
Bugsy is offline
Rexonspix
Junior Member
Join Date: Oct 2005
Location: Denmark
Old 08-01-2009 , 12:34   Re: Initialization data exceeds declared size
Reply With Quote #5

Oh like that

Anyways, I'm using the variable to either setting another variable, or using it in a format()
Etc.
Code:
playerJob[id] = rank; 
or 
format(menutext,255,"something %s",rank);
Rexonspix is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 08-01-2009 , 12:54   Re: Initialization data exceeds declared size
Reply With Quote #6

Quote:
Originally Posted by Rexonspix View Post
Oh like that

Anyways, I'm using the variable to either setting another variable, or using it in a format()
Etc.
Code:
playerJob[id] = rank; 
or 
format(menutext,255,"something %s",rank);
Just use it directly then.
PHP Code:
formatmenutext255 "Something %s" jobPoliceRankthe_rank_index ] ); 
If playerJob[id] holds the rank index, you can do:
PHP Code:
formatmenutext255 "Something %s" jobPoliceRankplayerJob[id] ] ); 
__________________

Last edited by Bugsy; 08-01-2009 at 13:57.
Bugsy 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 18:26.


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