Array index out of bounds
#1

Hallo guys i have problem with script, I need help

How to fix this

Debug with my server_log.txt
Код:
[08:40:33] [debug] #0 000829ac in public SystemTimer () from vliveb.amx
[08:40:33] [debug] Run time error 4: "Array index out of bounds"
[08:40:33] [debug]  Accessing element at index 1500 past array upper bound 1499
[08:40:33] [debug] AMX backtrace:
[08:40:33] [debug] #0 00082d44 in public VehicleTimer () from vliveb.amx
[08:40:34] [debug] Run time error 4: "Array index out of bounds"
[08:40:34] [debug]  Accessing element at index 1500 past array upper bound 1499
The public SystemTimer()
PHP код:
forward SystemTimer();
public 
SystemTimer()
{
    
RunningTime++;
    
// respawnowanie śmieciarek
    
for(new vid vid MAX_VEHICLES vid++)
    {
        if(
vehicle[vid][vownertype] == 1)
        {
            if(
vehicle[vid][vowneruid] == GROUP_TYPE_RUBBISH_UID || vehicle[vid][vowneruid] == GROUP_TYPE_PIZZA_UID)
            {
                if(!
IsVehicleOccupied(vid))
                {
                    if(
vehicle[vid][vRubbishUnspawn] >= 60)
                    {
                        
vehicle[vid][vRubbishUnspawn] = ;
                        
RespawnVehicle(vid);
                    }
                    else
                    {
                        
vehicle[vid][vRubbishUnspawn]++;
                    }
                }
            }
        }
    }
    
    
// czyszczenie opisow niezalogownych postaci
    
for(new MAX_PLAYERSi++)
    {
        if(!
IsPlayerConnect(i))
        {
            
UpdateDynamic3DTextLabelText(Text3D:PlayerDesc[i], COLOR_ME" ");
        }
    }

and public VehicleTimer ()

PHP код:
forward VehicleTimer();
public 
VehicleTimer()
{
    for(new 
MAX_VEHICLESi++)
    {
        new 
Float:VehHP;
        
GetVehicleHealth(i,VehHP);
        if(
VehHP 350)
        {
            
vehicle[i][vhp] = 350;
            
SetVehicleHealth(i,350);
        }
        
        
//offroad
        
new felgi GetVehicleComponentInSlot(iCARMODTYPE_WHEELS);
        if(
felgi == 1025)
        {
            new 
panels,doors,lights,tires;
            
GetVehicleDamageStatus(i,panels,doors,lights,tires);
            
            
UpdateVehicleDamageStatus(i,panels,doors,lights,0);
        }
    }

Reply
#2

Can you show me what 'vehicle' and 'PlayerDesc ' is defined as.
Reply
#3

The size you defined for vehicle is probably too small. I believe it's trying to access vehicle[1500] but it only goes up to vehicle[1499].
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)