Raised This Month: $32 Target: $400
 8% 

Solved Runtime error 4: index out of bounds


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Abhinash
Senior Member
Join Date: Jan 2015
Location: India,kolkata
Old 08-04-2020 , 16:35   Runtime error 4: index out of bounds
Reply With Quote #1

I am getting runtime error 4 on this simple part of code.
Can anyone help me to fix it ?
Code:
// Current Weapon info
public message_cur_weapon(id)
{
	// Not alive or zombie
	if (!g_isalive[id] || g_zombie[id])
		return;
	
	if (g_sniper[id])
		return;
	
	if (b_uAmmo[id])
	{
		// HUD should show full clip all the time
		set_msg_arg_int(3, get_msg_argtype(3), MAXCLIP[weapon])
	}
}
Error on this line : if (!g_isalive[id] || g_zombie[id])

Last edited by Abhinash; 08-04-2020 at 18:42.
Abhinash is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 08-04-2020 , 16:57   Re: Runtime error 4: index out of bounds
Reply With Quote #2

Show how the two variables are defined.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-04-2020 , 22:49   Re: Runtime error 4: index out of bounds
Reply With Quote #3

Any time that you have an error like this you should add your own debugging code to determine the value being passed to the various arrays being used on or near the line that has the problem. It will often lead you to the answer. If you're going to be posting in the Scripting Help section, this should be your first step unless it is difficult to reproduce.
__________________
fysiks is offline
Abhinash
Senior Member
Join Date: Jan 2015
Location: India,kolkata
Old 08-05-2020 , 03:49   Re: Runtime error 4: index out of bounds
Reply With Quote #4

Actually the message function required 3 parameters to run that's why
Abhinash 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:59.


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