AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help with this script... (https://forums.alliedmods.net/showthread.php?t=20596)

[ --<-@ ] Black Rose 11-12-2005 08:14

Help with this script...
 
ok... i'm trying to make a new mod but some errors
it says
Code:

L 11/12/2005 - 13:59:38: [AMXX] Run time error 4: index out of bounds (array "PlayerLevel[33]") (indexed "[28]")
L 11/12/2005 - 13:59:38: [AMXX]    [0] LOTR.sma::ShowHUD (line 359)
L 11/12/2005 - 13:59:40: [AMXX] Displaying debug trace (plugin "LOTR.amxx")
L 11/12/2005 - 13:59:40: [AMXX] Run time error 4: index out of bounds (array "PlayerLevel[33]") (indexed "[79]")
L 11/12/2005 - 13:59:40: [AMXX]    [0] LOTR.sma::ShowHUD (line 359)
L 11/12/2005 - 13:59:44: [AMXX] Displaying debug trace (plugin "LOTR.amxx")
L 11/12/2005 - 13:59:44: [AMXX] Run time error 4: index out of bounds (array "PlayerLevel[33]") (indexed "[80]")

lots of these...
also I dunno, but I think I don't get xp, and I get levels all the time... :?

XxAvalanchexX 11-12-2005 12:20

Maybe PlayerLevel[id] + 1 is more than MAXLEVELS?

[ --<-@ ] Black Rose 11-12-2005 14:41

in ShowHUD?

XxAvalanchexX 11-12-2005 16:06

Yes.

[ --<-@ ] Black Rose 11-13-2005 05:41

here it is
Code:
public ShowHUD(id) {     new HUD[512]     new NextLevelXP = LEVELS[PlayerLevel[id]+1]     format(HUD, 511, "[%s] Level: %i XP: %i / %i", CLASSES[PlayerClass[id]], PlayerLevel[id], PlayerXP[id], NextLevelXP)     message_begin(MSG_ONE, msgtext, {0,0,0}, id)     write_byte(0)     write_string(HUD)     message_end()     return PLUGIN_HANDLED }
i know u have to do something bout level 10 in this thing...
Code:
new NextLevelXP = LEVELS[PlayerLevel[id]+1]
but that doesn't matter. I don't think thats the problem...if the level was 10 then indexed would be 11, right? so the prob is that I am gaining levels all the time and i don't know why... and it starts at lvl 1. i want it to start at lvl 0...

XxAvalanchexX 11-13-2005 12:53

Try this:

Code:
 public ShowHUD(id) {     client_print(id,print_chat,"* %d/%d",PlayerLevel[id]+1,MAXLEVELS);     new HUD[512]     new NextLevelXP = LEVELS[PlayerLevel[id]+1]     format(HUD, 511, "[%s] Level: %i XP: %i / %i", CLASSES[PlayerClass[id]], PlayerLevel[id], PlayerXP[id], NextLevelXP)     message_begin(MSG_ONE, msgtext, {0,0,0}, id)     write_byte(0)     write_string(HUD)     message_end()     return PLUGIN_HANDLED }

See if the first number ever exceeds the second number.


All times are GMT -4. The time now is 23:59.

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