Raised This Month: $51 Target: $400
 12% 

Solved Run time error 4: index out of bounds


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
amirwolf
Senior Member
Join Date: Feb 2019
Location: Iran
Old 01-04-2022 , 11:22   Run time error 4: index out of bounds
Reply With Quote #1

Hi, I have this error
HTML Code:
L 01/04/2022 - 19:43:52: Start of error session.
L 01/04/2022 - 19:43:52: Info (map "gg_fear") (file "addons/amxmodx/logs/error_20220104.log")
L 01/04/2022 - 19:43:52: [AMXX] Displaying debug trace (plugin "Reconnect.amxx")
L 01/04/2022 - 19:43:52: [AMXX] Run time error 4: index out of bounds 
L 01/04/2022 - 19:43:52: [AMXX]    [0] Reconnect.sma::client_disconnect (line 15)
L 01/04/2022 - 19:43:52: [AMXX]    [1] Reconnect.sma::addToReconnect (line 49)
L 01/04/2022 - 19:43:52: [AMXX]    [2] Reconnect.sma::client_disconnect (line 15)
PHP Code:
#include <amxmodx>

new Float:reconnectTableTime[33];
new 
reconnectTable[33][33];
new 
bool:userReconnected[33];

public 
client_connect(id){

    
addToReconnect(id0)
    
userReconnected[id] = false
}

public 
client_disconnect(id){

    
addToReconnect(id1)
}

public 
isInReconnect(id){
    new 
auth[33];
    
get_user_authid(idauthsizeof(auth) );
    for( new 
i=0;i<sizeof(reconnectTable); ++ ){
        if( 
equal(reconnectTable[i], auth) ){
            if( 
get_gametime()-reconnectTableTime[i] < 10.0 )
                return 
i;
        }
    }
    return -
1;
}
public 
addToReconnect(idtype){
    
    if( 
type == 0){
        new 
=isInReconnect(id);
        if( 
i!=-&& type == 0){
            
userReconnected[id] =true;
            return 
0;
        }
    }else{
        new 
auth[33];
        
get_user_authid(idauthsizeof(auth) );
        for( new 
0isizeofreconnectTable ); ++ ){
            if( 
get_gametime()-reconnectTableTime[i] > 10.0 ){            
                
copyreconnectTable], sizeofreconnectTable[ ] ), auth );
                
reconnectTableTime[i]=get_gametime();
                break;
            }
        }
        
    }
    return 
1;

__________________

Last edited by amirwolf; 01-04-2022 at 17:22.
amirwolf is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 01-04-2022 , 12:53   Re: Run time error 4: index out of bounds
Reply With Quote #2

Replace the client_connect function with one that checks if user is connected.
e.g.
Code:
public client_connect(id)
    !is_user_connected(id) ? server_print("Stopped Run time error 4: index out of bounds") : addToReconnect(id, 0) , userReconnected[id] = false
__________________
DJEarthQuake is offline
amirwolf
Senior Member
Join Date: Feb 2019
Location: Iran
Old 01-04-2022 , 13:02   Re: Run time error 4: index out of bounds
Reply With Quote #3

The same error again
__________________
amirwolf is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 01-04-2022 , 13:33   Re: Run time error 4: index out of bounds
Reply With Quote #4

PHP Code:
sizeof (auth


PHP Code:
charsmax(auth

,.................

PHP Code:
sizeofreconnectTable[ ] ) 


PHP Code:
 charsmax(reconnectTable[ ] ) 
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 01-04-2022 at 13:35.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
amirwolf
Senior Member
Join Date: Feb 2019
Location: Iran
Old 01-04-2022 , 17:22   Re: Run time error 4: index out of bounds
Reply With Quote #5

thank you
Solved
__________________
amirwolf 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 01:10.


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