Raised This Month: $ Target: $400
 0% 

Run Time Error 4 - Not sure why...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
nanbread
New Member
Join Date: Oct 2005
Old 10-17-2005 , 20:24   Run Time Error 4 - Not sure why...
Reply With Quote #1

Could some one explain why this is giving me:

Quote:
L 10/17/2005 - 18:14:20: [AMXX] Displaying debug trace (plugin "plugin_blatt_monster.amxx")
L 10/17/2005 - 18:14:20: [AMXX] Run time error 4: index out of bounds
L 10/17/2005 - 18:14:20: [AMXX] [0] phppwRw9w.sma::ManiaSpawn (line 575)
L 10/17/2005 - 18:14:20: [AMXX] [1] phppwRw9w.sma::ManiaTimer (line 566)
It's part of the plugin_blatt_monster.amxx plugin.

Code:
	new players[32]
	new chPl[2],num,pName[32]
	get_players(players,num,"ae","CT")
	chPl[0] = players[random(num)]  //this line causes the error (line 575)
	get_players(players,num,"ae","TERRORIST")
	chPl[1] = players[random(num)]
Help is appreciated.
nanbread is offline
geekforce
Junior Member
Join Date: Oct 2005
Old 10-22-2005 , 14:02  
Reply With Quote #2

index out of bounds mean that the number inside the [] of an array exceeds the max number..

Code:
new Array[32]

Array[0] = 1 //works
Array[31] = 1 //works too
Array[32] = 1 // error.. out fo bounds.. why?: new Array[32] initializes an array with 32 elements.. starting from 0 and up to 31...
//so make sure that the number doesnt exceed the max number :P
Hope you understand now..

*still pretty unstable with pawn/small... just know general coding stuff (wrote it to show you what i was meaning.. kinda.. meh )

-- GeekFOrce
__________________
C# allows you to shoot yourself in the foot rather easy, C++ allows you to reuse the bullet.
geekforce is offline
Reply


Thread Tools
Display Modes

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 23:56.


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