Raised This Month: $ Target: $400
 0% 

initialization data exceeds declared size


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MrEgg0
Junior Member
Join Date: Aug 2023
Old 08-24-2023 , 14:40   initialization data exceeds declared size
Reply With Quote #1

I need help plugin gunxp

I wanted to add a new weapon in the weaponlevel list, but when converting to amxx it shows this problem:


//// gunxpmod.sma
// D:\mjm\cs161\cstrike\addons\amxmodx\scripting \gunxpmod.sma(52) : error 018: initialization data exceeds declared size
// D:\mjm\cs161\cstrike\addons\amxmodx\scripting \gunxpmod.sma(53) : error 010: invalid function or declaration
// D:\mjm\cs161\cstrike\addons\amxmodx\scripting \gunxpmod.sma(57) : error 018: initialization data exceeds declared size
// D:\mjm\cs161\cstrike\addons\amxmodx\scripting \gunxpmod.sma(5 : error 010: invalid function or declaration
// D:\mjm\cs161\cstrike\addons\amxmodx\scripting \gunxpmod.sma(62) : error 018: initialization data exceeds declared size
//
// 5 Errors.
// Could not locate output file D:\mjm\cs161\cstrike\addons\amxmodx\scripting \compiled\gunxpmod.amx (compile failed).


This is the modification:


new const WEAPONCONST[MAXLEVEL][] = { "weapon_glock18", "weapon_usp", "weapon_p228", "weapon_fiveseven", "weapon_deagle", "weapon_elite", "weapon_tmp",
"weapon_mac10", "weapon_ump45", "weapon_mp5navy", "weapon_p90", "weapon_scout", "weapon_awp", "weapon_famas", "weapon_galil", "weapon_m3", "weapon_xm1014",
"weapon_ak47", "weapon_m4a1", "weapon_aug", "weapon_sg552", "weapon_sg550", "weapon_g3sg1", "weapon_m249" ,"m3dragon"
}; // Give Weapons




new const WEAPONMDL[MAXLEVEL][] = { "models/w_glock18.mdl", "models/w_usp.mdl", "models/w_p228.mdl", "models/w_fiveseven.mdl", "models/w_deagle.mdl", "models/w_elite.mdl", "models/w_tmp.mdl",
"models/w_mac10.mdl", "models/w_ump45.mdl", "models/w_mp5.mdl", "models/w_p90.mdl", "models/w_scout.mdl", "models/w_awp.mdl", "models/w_famas.mdl", "models/w_galil.mdl", "models/w_m3.mdl", "models/w_xm1014.mdl",
"models/w_ak47.mdl", "models/w_m4a1.mdl", "models/w_aug.mdl", "models/w_sg552.mdl", "models/w_sg550.mdl", "models/w_g3sg1.mdl", "models/w_m249.mdl", "models/z47_m3dragon/w_m3dragon.mdl"
}; // Blocks pick up weapon, don't change!




new const AMMOCONST[MAXLEVEL] = { 17, 16, 1, 11, 26, 10, 23, 7, 12, 19, 30, 3, 18,
15, 14, 21, 5, 28, 22, 8, 27, 13, 24, 20 ,25
};


Weapons added by me:

new const WEAPONCONST[MAXLEVEL]="m3dragon"

new const WEAPONMDL[MAXLEVEL] = "models/z47_m3dragon/w_m3dragon.mdl"

new const AMMOCONST[MAXLEVEL]= 25



Complete file below, I hope someone can help me, thank you
Attached Files
File Type: sma Get Plugin or Get Source (gunxpmod.sma - 86 views - 35.4 KB)

Last edited by MrEgg0; 08-24-2023 at 14:46.
MrEgg0 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-25-2023 , 01:32   Re: initialization data exceeds declared size
Reply With Quote #2

The plugin code that you attached didn't have your code in it. There is no point in attaching the original plugin when you can just provide a link to it. Attach YOUR custom code when you're making changes and need help.

Based on just the errors themselves, you need to make sure that the size of the arrays are correct. The arrays have a set size give by MAXLEVEL. If you add something to the array, you have too many items in the array so you need to fix that by increasing the size of the array.

P.S. When posting code snippets or even error output, put them in each in a code block so that your post become readable.
__________________
fysiks is offline
MrEgg0
Junior Member
Join Date: Aug 2023
Old 08-25-2023 , 03:27   Re: initialization data exceeds declared size
Reply With Quote #3

Quote:
Originally Posted by fysiks View Post
The plugin code that you attached didn't have your code in it. There is no point in attaching the original plugin when you can just provide a link to it. Attach YOUR custom code when you're making changes and need help.

Based on just the errors themselves, you need to make sure that the size of the arrays are correct. The arrays have a set size give by MAXLEVEL. If you add something to the array, you have too many items in the array so you need to fix that by increasing the size of the array.

P.S. When posting code snippets or even error output, put them in each in a code block so that your post become readable.
1-Is there an explanation of how to do this

2-How can I increase the size of the matrix? Is it possible to make the size of the array indefinite and how to do it

3-I'm sorry but I'm new here
MrEgg0 is offline
MrEgg0
Junior Member
Join Date: Aug 2023
Old 08-25-2023 , 03:47   Re: initialization data exceeds declared size
Reply With Quote #4

Quote:
Originally Posted by fysiks View Post

Based on just the errors themselves, you need to make sure that the size of the arrays are correct. The arrays have a set size give by MAXLEVEL. If you add something to the array, you have too many items in the array so you need to fix that by increasing the size of the array.


This way you mean to increase the size of an array?:

new const WEAPONCONST[][]
MrEgg0 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-25-2023 , 21:43   Re: initialization data exceeds declared size
Reply With Quote #5

Quote:
Originally Posted by MrEgg0 View Post
1-Is there an explanation of how to do this
I did essentially tell you how. I said that you need to increase the size of the arrays and that the size of the array is set by MAXLEVEL.

Quote:
Originally Posted by MrEgg0 View Post
2-How can I increase the size of the matrix? Is it possible to make the size of the array indefinite and how to do it
There are no matrices in this particular programming language. Yes, often there is a way to make certain arrays indefinite. You should probably to learn the basics of programming to be able to understand how this part works. Especially since this plugin is comprised of multiple files (I haven't actually looked at the other files so it may be simple or it may not be so simple).

Quote:
Originally Posted by MrEgg0 View Post
This way you mean to increase the size of an array?:

new const WEAPONCONST[][]
No. The brackets set the dimension of the array, not the size. Also, that variable is already a 2D array so that wouldn't change anything.

-------------------------------

If you're actually interested in learning how to write and modify plugins, you really need to start by learning the basic concepts of programming. There are many tutorials available to help you out with this. The first two tutorials under General Pawn Programming on this list of tutorials are probably good places to start. If you prefer visual analogies, looking at the picture tutorial might be best, otherwise the second one might be better.

Also, you should post in the Scripting Help forum for getting help with your own coding. If you're not wanting to learn how to code, you should post in the Suggestions/Requests forum and wait for someone to help you out.
__________________
fysiks is offline
MrEgg0
Junior Member
Join Date: Aug 2023
Old 08-26-2023 , 03:07   Re: initialization data exceeds declared size
Reply With Quote #6

Quote:
Originally Posted by fysiks View Post
I did essentially tell you how. I said that you need to increase the size of the arrays and that the size of the array is set by MAXLEVEL.



There are no matrices in this particular programming language. Yes, often there is a way to make certain arrays indefinite. You should probably to learn the basics of programming to be able to understand how this part works. Especially since this plugin is comprised of multiple files (I haven't actually looked at the other files so it may be simple or it may not be so simple).



No. The brackets set the dimension of the array, not the size. Also, that variable is already a 2D array so that wouldn't change anything.

-------------------------------

If you're actually interested in learning how to write and modify plugins, you really need to start by learning the basic concepts of programming. There are many tutorials available to help you out with this. The first two tutorials under General Pawn Programming on this list of tutorials are probably good places to start. If you prefer visual analogies, looking at the picture tutorial might be best, otherwise the second one might be better.

Also, you should post in the Scripting Help forum for getting help with your own coding. If you're not wanting to learn how to code, you should post in the Suggestions/Requests forum and wait for someone to help you out.
Thank you my friend for the information

I have the basics of programming variables, constants, arrays, pointers, etc., but my problem is with the program. There are no videos explaining the program.
MrEgg0 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-26-2023 , 03:45   Re: initialization data exceeds declared size
Reply With Quote #7

Ok, then post the plugin (attach the file) with your modifications because what you posted in your original post implies that you don't know how arrays work in Pawn.
__________________

Last edited by fysiks; 08-26-2023 at 03:46.
fysiks 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 08:54.


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