AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   (Help)? Run time error 4: index out of bounds (https://forums.alliedmods.net/showthread.php?t=299013)

felipemilralze 06-29-2017 15:37

(Help)? Run time error 4: index out of bounds
 
L 06/29/2017 - 16:35:03: Start of error session.
L 06/29/2017 - 16:35:03: Info (map "de_dust2") (file "addons/amxmodx/logs/error_20170629.log")
L 06/29/2017 - 16:35:03: [AMXX] Displaying debug trace (plugin "zoa_sistema_patente.amxx")
L 06/29/2017 - 16:35:03: [AMXX] Run time error 4: index out of bounds
L 06/29/2017 - 16:35:03: [AMXX] [0] zoa_sistema_patente.sma::check_patente (line 466)
L 06/29/2017 - 16:35:03: [AMXX] [1] zoa_sistema_patente.sma::client_putinserver (line 248)

PHP Code:

public client_putinserver(id)
{
    
check_patente(id0)
}

public 
check_patente(idsound)
{
    if(!
is_user_connected(id)) return PLUGIN_HANDLED
    
    
new name[33]
    
get_user_name(idnamecharsmax(name))
    
    if(
iPATENTE[id] < 16)
    {
        while((
iXP[id] >= XP[iPATENTE[id] + 1]))
        {
            
iPATENTE[id]++
            
            if(
sound)
            {
                
ColorChat(0GREEN"[z]Oa|^x01 Parabens,^x03 %s^x01 sua patente agora e:^x04 %s"namePATENTE[iPATENTE[id]])
                
client_cmd(0"spk ambience/lv_fruit1.wav")
            }
        }
    }
    
    if(
iPATENTE[id] > 1)
    {
        while((
iXP[id] < XP[iPATENTE[id]]))
        {
            
iPATENTE[id]--
            
            if(
sound)
            {
                
ColorChat(0GREEN"[z]Oa|^x01 Parabens,^x03 %s^x01 sua patente agora voltou para:^x04 %s"namePATENTE[iPATENTE[id]])
                
client_cmd(0"spk ambience/wolfhowl02.wav")
            }
        }
    }
    
    return 
PLUGIN_HANDLED



klippy 06-29-2017 17:09

Re: (Help)? Run time error 4: index out of bounds
 
We can't possibly know which line is 466 in the code you posted. Also that's not enough code to determine the problem.

felipemilralze 06-29-2017 18:08

Re: (Help)? Run time error 4: index out of bounds
 
Quote:

Originally Posted by KliPPy (Post 2532534)
We can't possibly know which line is 466 in the code you posted. Also that's not enough code to determine the problem.

line 466 while((iXP[id] >= XP[iPATENTE[id] + 1]))
line 248 check_patente(id, 0)

klippy 06-29-2017 18:28

Re: (Help)? Run time error 4: index out of bounds
 
Quote:

Also that's not enough code to determine the problem.

Natsheh 06-30-2017 03:32

Re: (Help)? Run time error 4: index out of bounds
 
Post the arrays size..

felipemilralze 06-30-2017 18:06

Re: (Help)? Run time error 4: index out of bounds
 
I managed to clean it, thanks for the attention.


All times are GMT -4. The time now is 22:50.

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