Raised This Month: $ Target: $400
 0% 

Level and XP System problem


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Xladen18
New Member
Join Date: Dec 2022
Old 12-16-2022 , 15:11   Level and XP System problem
Reply With Quote #1

Im getting 2 errors on xp and leves system

Error: Array index out of bounds (variable "g_mPlayerData") on line 178
Error: Array index out of bounds (variable "g_mPlayerData") on line 616

This is line 178
PHP Code:
public eShowHud(id
{
    
set_hudmessage(02552550.010.18012.012.00.010.01, -1)    
    
    if( 
g_iPlayerLevel[id] > MAXLEVEL 1)
    {
        
ShowSyncHudMsg(idSyncHudRankSystem,"[ Ime: %s ]^n[ Rank: %s ]^n[ EXP: %i / %i ]^n[ Level: %i / %i ]",
        
szPlayerName[id],
        
g_mPlayerDatag_iPlayerLevelid ] ][ m_szRankName ],
        
g_iPlayerXPid ],
        
g_mPlayerDataMAXLEVEL ][ m_iRankXP ],
        
g_iPlayerLevel[id], MAXLEVEL );
    }
    else 
    {
        
ShowSyncHudMsg(idSyncHudRankSystem,"[ Ime: %s ]^n[ Rank: %s ]^n[ EXP: %i / %i ]^n[ Level: %i / %i ]",
        
szPlayerName[id],
        
g_mPlayerDatag_iPlayerLevelid ] ][ m_szRankName ],
        
g_iPlayerXPid ],
        
g_mPlayerDatag_iPlayerLevelid ] + ][ m_iRankXP ],
        
g_iPlayerLevel[id], MAXLEVEL );
    }

And this is line 616

PHP Code:
public _get_user_max_xp(iPlugin,iParams)
{
    new 
iMaxLevel
    
    
if(g_iPlayerLevel[get_param)] > MAXLEVEL 1
        
iMaxLevel g_mPlayerDataMAXLEVEL ][ m_iRankXP ]
    else
        
iMaxLevel g_mPlayerDatag_iPlayerLevelget_param) ] + ][ m_iRankXP ]
    
    return 
iMaxLevel

And here i created g_mPlayerData

PHP Code:
new const g_mPlayerData[ ][ mData ] = {
    { 
"Noob"},
    { 
"Pocetnik"90 },
    { 
"Strelac"180 },
    { 
"Super Strelac"300 },
    { 
"Odlican Strelac"450 },
    { 
"Ubica"700 },
    { 
"Serijski Ubica"1200 },
    { 
"Monstrum"1800 },
    { 
"Profesionalac"2800 },
    { 
"Pesadinac"4100 },
    { 
"Mitraljezac"5200 },
    { 
"Razvodnik"6000 },
    { 
"Desetar"6800 },
    { 
"Mladji Vodnik"8200 },
    { 
"Vodnik"10200 },
    { 
"Vodnik Prve Klase"12000 },
    { 
"Stariji Vodnik"15000 },
    { 
"Stariji Vodnik Prve Klase"17500 },
    { 
"Zastavnik"20500 },
    { 
"Zastavnik Prve Klase"25500 },
    { 
"Potporucnik"29000 },
    { 
"Porucnik"35000 },
    { 
"Kapetan"46000 },
    { 
"Kapetan Prve Klase"58000 },
    { 
"Major"71000 },
    { 
"Potpukovnik"85000 },
    { 
"Pukovnik"100000 },
    { 
"Brigadni General"116000 },
    { 
"General Major"133000 },
    { 
"General Potpukovnik"151000 },
    { 
"General Pukovnik"170000 },
    { 
"General"190000 },
    { 
"Ministar Odbrane"211000 },
    { 
"Komadant"233000 },
    { 
"Vrhovni Komadant"9999999 }
}; 
Full code: https://pastebin.com/XMS5PLBu

Last edited by Xladen18; 12-17-2022 at 13:13. Reason: Code not in PHP mode
Xladen18 is offline
 


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 15:36.


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