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

Solved Simple Noob Question


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
NC.svtrade
Senior Member
Join Date: Nov 2015
Old 03-16-2018 , 12:34   Simple Noob Question
Reply With Quote #1

HTML Code:
C:\Programming\SorucePawn\Compile\include\tfcs/tfcs_weapon.sp(115) : error 032: array index out of bounds (variable "g_iWeaponSlot")
C:\Programming\SorucePawn\Compile\include\tfcs/tfcs_weapon.sp(127) : error 032: array index out of bounds (variable "g_iWeaponSlot")
C:\Programming\SorucePawn\Compile\include\tfcs/tfcs_weapon.sp(144) : error 032: array index out of bounds (variable "g_iDropWeapon")
C:\Programming\SorucePawn\Compile\include\tfcs/tfcs_weapon.sp(145) : error 032: array index out of bounds (variable "g_iDropWeapon")
C:\Programming\SorucePawn\Compile\include\tfcs/tfcs_weapon.sp(146) : error 032: array index out of bounds (variable "g_iDropWeapon")
C:\Programming\SorucePawn\Compile\include\tfcs/tfcs_weapon.sp(183) : error 032: array index out of bounds (variable "g_iWeaponSlot")
C:\Programming\SorucePawn\Compile\include\tfcs/tfcs_weapon.sp(184) : error 032: array index out of bounds (variable "g_iWeaponSlot")
C:\Programming\SorucePawn\Compile\include\tfcs/tfcs_weapon.sp(271) : error 032: array index out of bounds (variable "g_iWeaponSlot")
C:\Programming\SorucePawn\Compile\include\tfcs/tfcs_weapon.sp(272) : error 032: array index out of bounds (variable "g_iWeaponSlot")
C:\Programming\SorucePawn\Compile\include\tfcs/tfcs_weapon.sp(420) : error 032: array index out of bounds (variable "g_iDropWeapon")
C:\Programming\SorucePawn\Compile\include\tfcs/tfcs_weapon.sp(421) : error 032: array index out of bounds (variable "g_iDropWeapon")
C:\Programming\SorucePawn\Compile\include\tfcs/tfcs_weapon.sp(422) : error 032: array index out of bounds (variable "g_iDropWeapon")
C:\Programming\SorucePawn\Compile\include\tfcs/tfcs_weapon.sp(430) : error 032: array index out of bounds (variable "g_iWeaponSlot")
C:\Programming\SorucePawn\Compile\include\tfcs/tfcs_weapon.sp(446) : error 032: array index out of bounds (variable "g_iWeaponSlot")

Code

Code:
enum WeaponList {
	String:WL_OriginName[DEF_STRLEN],
	WL_CSType,
	WL_CSMoney,
	bool:WL_SilencerAllowed
};




enum WeaponMainInfo {
	String:WMI_Name[DEF_STRLEN], // 무기 이름
	bool:WMI_IsActive = false, // 무기 사용 가능 여부
	WMI_CSIndex = -1, // 무기 카스 인덱스 
	WMI_Entity = INVALID_ENT_REFERENCE, // 무기 실존시
	bool:WA_HasSilencer = false,
	Float:WA_SilencerIn,
	Float:WA_SilencerOut,
	WL_TFAmmo,
	WL_TFClip
};
Code:
// Main Enum Variables
//new g_iWeaponType[MAX_TYPES]
new g_iWeaponList[MAX_INDEXES][WeaponList]; // Weapon List Bus
new g_iWeaponSlot[MAXPLAYERS+1][MAX_SLOT][WeaponMainInfo]; // Main Bus
Code:
	if(StrEqual(arg, "cs_iIndex")) g_iWeaponSlot[client][slot][WMI_CSIndex] = StringToInt(arg2);
	if(StrEqual(arg, "cs_iEntity")) g_iWeaponSlot[client][slot][WMI_Entity] = StringToInt(arg2);
Code:
	g_iDropWeapon[entity][DI_CSIndex] = -1
	g_iDropWeapon[entity][DI_TFAmmo] = -1
	g_iDropWeapon[entity][DI_TFAmmo] = -1
	g_iDropWeapon[entity][DI_HasSilencer] = false

hanging on these error for 1 week... please.. help me

Last edited by NC.svtrade; 03-16-2018 at 20:59.
NC.svtrade is offline
Reiko1231
Member
Join Date: Apr 2013
Location: Russia
Old 03-16-2018 , 13:09   Re: Simple Noob Question
Reply With Quote #2

I'm not sure but enumeration is a way to write numeric constant as symbolic. These errors are probably because WMI_CSIndex is converted to -1 resulting into g_iWeaponSlot[client][slot][-1]. And -1 this is not correct value for array index. Same goes for g_iDropWeapon[entity][DI_CSIndex] (you did'nt show your defenition of DI_CSIndex).

Last edited by Reiko1231; 03-16-2018 at 13:10.
Reiko1231 is offline
NC.svtrade
Senior Member
Join Date: Nov 2015
Old 03-16-2018 , 13:25   Re: Simple Noob Question
Reply With Quote #3

Quote:
Originally Posted by Reiko1231 View Post
I'm not sure but enumeration is a way to write numeric constant as symbolic. These errors are probably because WMI_CSIndex is converted to -1 resulting into g_iWeaponSlot[client][slot][-1]. And -1 this is not correct value for array index. Same goes for g_iDropWeapon[entity][DI_CSIndex] (you did'nt show your defenition of DI_CSIndex).
Then, what should it be good to use for it?
NC.svtrade is offline
Fyren
FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren
Join Date: Feb 2106
Old 03-16-2018 , 14:12   Re: Simple Noob Question
Reply With Quote #4

PHP Code:
enum WeaponMainInfo {
    
String:WMI_Name[DEF_STRLEN], // 무기 이름
    
bool:WMI_IsActive false// 무기 사용 가능 여부
    
WMI_CSIndex = -1// 무기 카스 인덱스 
    
WMI_Entity INVALID_ENT_REFERENCE// 무기 실존시
    
bool:WA_HasSilencer false,
    
Float:WA_SilencerIn,
    
Float:WA_SilencerOut,
    
WL_TFAmmo,
    
WL_TFClip
}; 
When you set values for the enum members, you're probably going to break using it to index arrays. Setting the value in the enum isn't going to set a default value in the array.
Fyren is offline
NC.svtrade
Senior Member
Join Date: Nov 2015
Old 03-16-2018 , 20:59   Re: Simple Noob Question
Reply With Quote #5

Quote:
Originally Posted by Fyren View Post
PHP Code:
enum WeaponMainInfo {
    
String:WMI_Name[DEF_STRLEN], // 무기 이름
    
bool:WMI_IsActive false// 무기 사용 가능 여부
    
WMI_CSIndex = -1// 무기 카스 인덱스 
    
WMI_Entity INVALID_ENT_REFERENCE// 무기 실존시
    
bool:WA_HasSilencer false,
    
Float:WA_SilencerIn,
    
Float:WA_SilencerOut,
    
WL_TFAmmo,
    
WL_TFClip
}; 
When you set values for the enum members, you're probably going to break using it to index arrays. Setting the value in the enum isn't going to set a default value in the array.
Solved.
NC.svtrade 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:34.


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