Raised This Month: $ Target: $400
 0% 

Index out of Bounds


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
egbertjan
Senior Member
Join Date: Mar 2007
Location: The Netherlands
Old 12-20-2011 , 12:34   Index out of Bounds
Reply With Quote #1

Hello,

So my problem is as following:
PHP Code:
L 12/20/2011 18:17:01: [AMXXDisplaying debug trace (plugin "DiabloModNew.amxx")
L 12/20/2011 18:17:01: [AMXXRun time error 4index out of bounds 
L 12
/20/2011 18:17:01: [AMXX]    [0DiabloModNew.sma::Give_Xp (line 1615)
L 12/20/2011 18:17:01: [AMXX]    [1DiabloModNew.sma::roundboost (line 976)
L 12/20/2011 18:17:01: [AMXX]    [2DiabloModNew.sma::RoundStart (line 956)
L 12/20/2011 18:17:01: [AMXXDisplaying debug trace (plugin "DiabloModNew.amxx")
L 12/20/2011 18:17:01: [AMXXRun time error 4index out of bounds 
L 12
/20/2011 18:17:01: [AMXX]    [0DiabloModNew.sma::write_hud (line 1822)
L 12/20/2011 18:17:01: [AMXX]    [1DiabloModNew.sma::UpdateHUD (line 1842
Line 1822 is the following line:
PHP Code:
format(tpstring,1023,"Class: %s Level: %i (%0.0f%s) Item: %s"Race[player_class[id]], player_lvl[id], perc,"%%",player_item_name[id]) 
So I figured that the problem is the Class: part. The Race[player_class[id] (after deleting the item and the perc part).
It has the following arrays:
PHP Code:
new Race[5][18] = { "None","Mage","Paladin","Ninja","Demon Hunter" }
new 
player_class_lvl[33][5
Does anyone know what could be the problem?

*Note: I am trying to build a new customized Diablo mod and have deleted a few races. The problem occured after deleting them. I thought I was doing it the correct way as I also know how to add them I thought it would be the exact opossosit.

Last edited by egbertjan; 12-20-2011 at 12:48.
egbertjan is offline
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 12-20-2011 , 15:41   Re: Index out of Bounds
Reply With Quote #2

Why "new player_class_lvl[33][5]" ?

It should be player_class[ 33 ][ 5 ]

And what is the 18 of new Race[ 5 ][ 18 ] ?
__________________
You can do anything you set your mind to, man.

Devil259 is offline
egbertjan
Senior Member
Join Date: Mar 2007
Location: The Netherlands
Old 12-20-2011 , 15:51   Re: Index out of Bounds
Reply With Quote #3

Oh I'm sorry, I posted the wrong one I will just post the ones relayed to it.

PHP Code:
enum NONE 0MagePaladinNinjaDemon_Hunter}
new 
Race[5][18] = { "None","Mage","Paladin","Ninja","Demon Hunter" }
new 
race_heal[5] = { 100,150,150,150,150 }
new 
LevelXP[153] = { 0,50,125,225,350,500,700,950,1250,1600,                        //10
        
2000,2450,2950,3500,4100,4750,5450,6200,7000,7850,                            //20
        
8750,9700,10700,11750,12850,14000,15200,16400,17750,19100,                    //30
        
20500,20500,21200,21950,23450,25000,27600,29250,30950,32700,                //40
        
34500,36350,38250,40200,44250,46350,48500,50700,52950,55250,                //50
        
57600,57600,60000,62500,65100,67800,70600,73500,76500,79600,                //60
        
82800,86100,89500,93000,96600,100300,104100,108000,112000,116100,            //70
        
120300,124600,129000,133500,138100,142800,147600,152500,157500,162600,        //80
        
173100,178400,183900,195200,201000,206900,212900,219000,225200,232500,        //90
        
238900,245400,252000,258700,265500,272400,279400,286500,293700,301000,        //100
        
316000,323800,331800,340000,348400,357000,365800,374800,384000,393400,        //110
        
403000,412800,422800,433000,443400,443400,454000,464800,475800,487000,        //120    
        
498400,510000,521800,533800,546000,558400,571000,583800,596800,610000,        //130
        
623400,637000,650800,664800,679000,693400,708000,722800,737800,753000,        //140
        
768400,768400,784000,799800,815800,832000,848400,865000,881800,898800,        //150
        
916000,99999999999,999999999999                                                //151    
}
new 
player_class_lvl[33][5]
new 
player_class_lvl_save[33]
new 
player_xp_old[33]
new 
database_user_created[33]
new 
srv_avg[5] = {1,1,1,1,1
The [18] is from the default script. I am not sure why it is there. But with the default one it works so I thought it was better to leave it be. If you suggest to remove it then I will remove it
egbertjan is offline
Old 12-20-2011, 16:25
Devil259
This message has been deleted by Devil259.
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 12-21-2011 , 06:37   Re: Index out of Bounds
Reply With Quote #5

You should remake the plugin from 0.

For example, you can do something like that :

Code:
new const Race[ ][ ] = {     "None",     "Mage",     "Paladin",     "Ninja",     "Demon Hunter" } new const RaceHeal[ ] = {     100,     150,     150,     150,     150 } new const LevelXP[ ] = {     0,50,125,225,350,500,700,950,1250,1600,     2000,2450,2950,3500,4100,4750,5450,6200,7000,7850,     8750,9700,10700,11750,12850,14000,15200,16400,17750,19100,     20500,20500,21200,21950,23450,25000,27600,29250,30950,32700,     34500,36350,38250,40200,44250,46350,48500,50700,52950,55250,     57600,57600,60000,62500,65100,67800,70600,73500,76500,79600,     82800,86100,89500,93000,96600,100300,104100,108000,112000,116100,     120300,124600,129000,133500,138100,142800,147600,152500,157500,162600,     173100,178400,183900,195200,201000,206900,212900,219000,225200,232500,     238900,245400,252000,258700,265500,272400,279400,286500,293700,301000,     316000,323800,331800,340000,348400,357000,365800,374800,384000,393400,     403000,412800,422800,433000,443400,443400,454000,464800,475800,487000,       498400,510000,521800,533800,546000,558400,571000,583800,596800,610000,     623400,637000,650800,664800,679000,693400,708000,722800,737800,753000,     768400,768400,784000,799800,815800,832000,848400,865000,881800,898800,     916000,99999999999,999999999999 }   new PlayerXP[ 33 ] , PlayerLevel[ 33 ] , PlayerClass[ 33 ][ 13 ] // for example , to add XP public fw_Ham_Killed( victim , inflictor , attacker ) {     if( attacker != victim )     {         PlayerXP[ id ] += 50         if( PlayerXP[ id ] >= LevelXP[ PlayerLevel[ id ] ] )         {             PlayerXP[ id ] -= LevelXP[ PlayerLevel[ id ] ]             PlayerLevel[ id ]++         }     } }

If you want XP per class, you need to use another way. See New XP Mod Tutorial (or something like that) in Tut/Snippets section.
__________________
You can do anything you set your mind to, man.


Last edited by Devil259; 12-21-2011 at 06:39.
Devil259 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 11:49.


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