Raised This Month: $ Target: $400
 0% 

index out of bounds (yea another one) unresolved still


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
gzus
Member
Join Date: Jan 2007
Old 02-18-2007 , 09:20   index out of bounds (yea another one) unresolved still
Reply With Quote #1

L 02/18/2007 - 09:174: [AMXX] Displaying debug trace (plugin "mho_mod.amxx")
L 02/18/2007 - 09:174: [AMXX] Run time error 4: index out of bounds
L 02/18/2007 - 09:174: [AMXX] [0] mho_mod.sma::ShowHUD (line 709)
L 02/18/2007 - 09:174: [AMXX] [1] mho_mod.sma:oChooseRace (line 22

ive been tryin to dig thro the forums here to find a fix, or get an idea how to fix this, but i havent see anything close to it yet.. heres my code:
PHP Code:

ShowHUD
(id// line 228

public ShowHUD(id)    
    { 
    new 
HUD[61]
    
//new wtf = CLASSES[PlayerClass[id]]
    //++wtf
    
format(HUD60"[%s] Level: %i XP: %i"CLASSES[PlayerClass[id]], PlayerLevel[id], PlayerXP[id])   // line 709
    
    
message_begin(MSG_ONEmsgtext, {0,0,0}, id
    
write_byte(0
    
write_string(HUD
    
message_end() 
    new 
szName[32], szAuthId[32]
    
get_user_name(idszName31)
    
get_user_authid(idszAuthId31)
    
server_print("--MHO MOD-- [SHOWING HUD] for: %s AuthId: %s"szNameszAuthId)
    
//server_print("--MHO MOD-- HOOK HUD COMPLETE",0.05)
    
return

i understand that the problems in ShowHUD, and this should be a fix, changin new HUD[51] to something higher, but its not working for me, i get other errors when i raise HUD.. any ideas?
__________________
71.200.20.142:27017 - testing mho mod
if you need any files visit clan.mosthatedonline.com

Last edited by gzus; 02-18-2007 at 12:20. Reason: fixed code
gzus is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 02-18-2007 , 09:22   Re: index out of bounds (yea another one)
Reply With Quote #2

I can't read a word of that code, try wrapping it in [ php][/php] or [ code][/code]
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
gzus
Member
Join Date: Jan 2007
Old 02-18-2007 , 09:38   Re: index out of bounds (yea another one) EDITED
Reply With Quote #3

sorry bout that, i had misplaced tags
__________________
71.200.20.142:27017 - testing mho mod
if you need any files visit clan.mosthatedonline.com
gzus is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 02-18-2007 , 09:54   Re: index out of bounds (yea another one) EDITED
Reply With Quote #4

Try printing each one on its own, but if you don't want to do that I'm thinking that their class isn't being set properly, and that you're referencing a class that's outside the bounds.
__________________

Last edited by Hawk552; 02-18-2007 at 09:57.
Hawk552 is offline
Send a message via AIM to Hawk552
gzus
Member
Join Date: Jan 2007
Old 02-18-2007 , 10:13   Re: index out of bounds (yea another one) EDITED
Reply With Quote #5

ok ok, some how its tryin to display XP as the level, which throw that error because there isnt like 1000 levels and such, im workin on this now, thanks for the idea or printing it out one by one lol hnestly i wouldnt have thought to do that.. in vb i output every string into msgboxes when im debuggin, but in new to this, so im still learnin the ropes
__________________
71.200.20.142:27017 - testing mho mod
if you need any files visit clan.mosthatedonline.com
gzus is offline
gzus
Member
Join Date: Jan 2007
Old 02-18-2007 , 11:55   Re: index out of bounds (yea another one) EDITED
Reply With Quote #6

nope, i thought i had it.. heres the console printouts..


--MHO MOD-- [Race Menu] Displayed for: Flow AuthId: STEAM_0:0:4188537
--MHO MOD-- [hooking hud] Setting Player Stats for: Flow AuthId: STEAM_0:0:4188537
--MHO MOD-- [SHOWING HUD] for: Flow ---- [Mutant] Level: 0 XP: 0
--MHO MOD-- KEY 3 SELECTED - Machine for: Flow AuthId: STEAM_0:0:4188537
--MHO MOD-- [SAVED Choosen] Race for: Flow AuthId: STEAM_0:0:4188537
--MHO MOD-- SAVED MACHINE XP
--MHO MOD-- Loaded XP for: Machine
L 02/18/2007 - 11:54:07: [AMXX] Displaying debug trace (plugin "mho_mod.amxx")
L 02/18/2007 - 11:54:07: [AMXX] Run time error 4: index out of bounds
L 02/18/2007 - 11:54:07: [AMXX] [0] mho_mod.sma::ShowHUD (line 709)
L 02/18/2007 - 11:54:07: [AMXX] [1] mho_mod.sma:oChooseRace


i'll attach the plugin if anyone cares to help..

what i did was change the HUD[51] to 33, then set the format to 32.. this is what gave me these error messages..
Attached Files
File Type: sma Get Plugin or Get Source (mho_mod.sma - 634 views - 33.6 KB)
__________________
71.200.20.142:27017 - testing mho mod
if you need any files visit clan.mosthatedonline.com
gzus is offline
Greenberet
AMX Mod X Beta Tester
Join Date: Apr 2004
Location: Vienna
Old 02-18-2007 , 12:30   Re: index out of bounds (yea another one) unresolved still
Reply With Quote #7

Code:
new const CLASSES[MAXCLASSES][] = {     "Mutant",     "Alien",     "Predator",     "Machine" }

you are missing the "nothing" class in the array.
Machine id is 4 but in the array the index of it is 3 ( same with the others ).
so if you choose Machine you will get "Run time error 4".

Code:
new const CLASSES[MAXCLASSES][] = {     "Nothing",     "Mutant",     "Alien",     "Predator",     "Machine" }

try this
Greenberet is offline
Send a message via ICQ to Greenberet Send a message via MSN to Greenberet
gzus
Member
Join Date: Jan 2007
Old 02-18-2007 , 12:53   Re: index out of bounds (yea another one) unresolved still
Reply With Quote #8

well damn that worked, i was trying to eliminate the nothing/none race, thanks!
__________________
71.200.20.142:27017 - testing mho mod
if you need any files visit clan.mosthatedonline.com
gzus 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 00:37.


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