AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   index out of bounds (yea another one) unresolved still (https://forums.alliedmods.net/showthread.php?t=51452)

gzus 02-18-2007 09:20

index out of bounds (yea another one) unresolved still
 
L 02/18/2007 - 09:17:34: [AMXX] Displaying debug trace (plugin "mho_mod.amxx")
L 02/18/2007 - 09:17:34: [AMXX] Run time error 4: index out of bounds
L 02/18/2007 - 09:17:34: [AMXX] [0] mho_mod.sma::ShowHUD (line 709)
L 02/18/2007 - 09:17:34: [AMXX] [1] mho_mod.sma::DoChooseRace (line 228)

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?

Hawk552 02-18-2007 09:22

Re: index out of bounds (yea another one)
 
I can't read a word of that code, try wrapping it in [ php][/php] or [ code][/code]

gzus 02-18-2007 09:38

Re: index out of bounds (yea another one) EDITED
 
sorry bout that, i had misplaced tags

Hawk552 02-18-2007 09:54

Re: index out of bounds (yea another one) EDITED
 
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.

gzus 02-18-2007 10:13

Re: index out of bounds (yea another one) EDITED
 
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

gzus 02-18-2007 11:55

Re: index out of bounds (yea another one) EDITED
 
1 Attachment(s)
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::DoChooseRace


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..

Greenberet 02-18-2007 12:30

Re: index out of bounds (yea another one) unresolved still
 
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

gzus 02-18-2007 12:53

Re: index out of bounds (yea another one) unresolved still
 
well damn that worked, i was trying to eliminate the nothing/none race, thanks!


All times are GMT -4. The time now is 00:37.

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