AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Menu Problems with loop (https://forums.alliedmods.net/showthread.php?t=121007)

gladius 03-10-2010 14:12

Menu Problems with loop
 
My problem is how I can get "playername [1]," stay with "PlayerLevel [0]"

I did a menu, but the way that I did it don't works, tells me this error in the console:
Run time error 4: index out of bounds
I look at the "debug" and the error is on the line 685 (plugin full) it would be this
formatex(Item, 299, "\w%s \d- \yProrecs Necesarios: \r%d", PlayerName[i], PlayerLevels[i])

my code:
PHP Code:

new const PlayerName[13][] = {
    
"Recien Llegado"
    
"Noob"
    
"Principiante"
    
"Aprendiz"
    
"Normal"
    
"Bueno"
    
"Muy Bueno"
    
"Excelente"
    
"Profesional"
    
"Chuck Norris"
    
"Ultra Brigido"
    
"Campeon"
    
"KZ Man"
}
new const 
PlayerLevels[12][] = {
    
1
    
3
    
7
    
16
    
25
    
37
    
50
    
70
    
100
    
150
    
200
    
300


public 
plugin_init() {
    
register_plugin("A""B""C")
    
    
register_clcmd("say /info""StatusMenu")
}

public 
StatusMenu(id)
{    
    new 
Menu menu_create("\yInfo Status Menu""StatusHandler")
    
    for(new 
013i++ ) {
        if( 
equalPlayerName], PlayerName] ) )
            continue;
            
        new 
szItem300 ], iPos];
        
num_to_striiPossizeofiPos ) - );
        
formatexszItem299"\w%s \d- \yasdf Necesarios: \r%d"PlayerName], PlayerLevels] );
        
menu_additemMenuszItemiPos );
    }
    
    
menu_setpropMenuMPROP_EXITMEXIT_ALL );
    
menu_displayidMenu0);
    return 
PLUGIN_HANDLED;


Then I want to make

I want that does not appear "Recien Llegado"

//Menu
Noob - asdf Necesarios: 1
Principiante - asdf Necesarios: 3
Aprendiz - asdf Necesarios: 7
etc..

I hope you can help me :)

*my English is not very good

fysiks 03-10-2010 18:09

Re: Menu Problems with loop
 
PlayerLevels[12] does not exist. You need to add one more cell to make it work in that loop.


All times are GMT -4. The time now is 08:43.

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