View Single Post
Author Message
micapat
Veteran Member
Join Date: Feb 2010
Location: Nyuu, nyuu (France).
Old 11-25-2021 , 17:40   Re: Invalid index with array checked by timer
Reply With Quote #1

Dirty but should work:

PHP Code:
public Action Timer_Checker(Handle timer)
{
    if(!
cv_enable.BoolValue)
        return;
        
    
int size GetArraySize(array_players_time);
    
    if (
size == 0
        return;
    
    if (
L4D_IsMissionFinalMap() == true)
        return; 
    
    
char steamid[64], sName[128];
    
    for (
int i 0sizei++)
    {
        if(
GetTime() > GetArrayCell(array_players_timei)+cv_time.IntValue)
        {
            
GetArrayString(array_players_idsisteamidsizeof(steamid));
            
GetArrayString(array_players_nameisNamesizeof(sName));
            
            
CPrintToChatAll("%t""leave_match"sName);
            
LogToFile(path"%s (%s) abandoned the match"sNamesteamid);
            
            
RemoveFromArray(array_players_timei);
            
RemoveFromArray(array_players_idsi);
            
RemoveFromArray(array_players_namei);

            
size--:
            
i--;
        }
    }

__________________
micapat is offline