Run time error 4

20. Maj 2021.
607
pregleda
9
postova
Cambio_Operacione
2
Rookie
20. Maj 2021.
Problem(error/warning): Svaki autorepair izbaci u logu ovo

Deo skripte:
forward Autorepair();
public Autorepair()
{
    for(new i = 0; i     {
    if(AdminDuty)
    {
        if(PlayerInfo >= 1)
        {
            new Float:health;
            GetPlayerHealth(i,health);
            if (health < 98.0)
            {
                SetPlayerHealth(i, 99.0);
            }
            new Float:arm;
            GetPlayerArmour(i,arm);
            if (arm < 98.0)
            {
                SetPlayerArmour(i, 99.0);
            }
        SetPVarInt(i, "PopravkaVozila", 1);
        new Float:vHealth;
        new vehicleid = GetPlayerVehicleID(i);
        GetVehicleHealth(vehicleid,vHealth);
        if(vHealth < 3589.0)
        {
      RepairVehicle(vehicleid);
SetVehicleHealth( GetPlayerVehicleID( vehicleid ), 3600.0 );
antiCheatCS[ vehicleid ][ VehRepairTime ] = 3;
vCanDrive[ GetPlayerVehicleID( vehicleid ) ] = 1;
        }
}
}
}
return 1;
}


Debug iz server_log(ukoliko je u pitanju crashanje servera - crashdetect log):
[13:55:46] AMX backtrace:
[13:55:46] #0 0069c8a4 in public Autorepair () from cshp.amx
[13:55:46] Run time error 4: "Array index out of bounds"
[13:55:46]   Accessing element at index 311 past array upper bound 49
ivan221
5
Made Man
🔥3
20. Maj 2021.
forward Autorepair();
public Autorepair()
{
    for(new i = 0; i     {
    if(IsPlayerConnected(i))
    {
    if(AdminDuty)
    {
        if(PlayerInfo >= 1)
        {
            new Float:health, Float:arm;
            GetPlayerHealth(i,health);
            GetPlayerArmour(i,arm);
            if(health < 98.0) SetPlayerHealth(i, 99.0);
            if(arm < 98.0) SetPlayerArmour(i, 99.0);
        SetPVarInt(i, "PopravkaVozila", 1);
        new vehicleid = GetPlayerVehicleID(i);
        if(vehicleid)
        {
        new Float:vHealth;
        GetVehicleHealth(vehicleid,vHealth);
        if(vHealth < 3589.0)
        {
      RepairVehicle(vehicleid);
SetVehicleHealth( GetPlayerVehicleID( vehicleid ), 3600.0 );
antiCheatCS[ vehicleid ][ VehRepairTime ] = 3;
vCanDrive[ GetPlayerVehicleID( vehicleid ) ] = 1;
        }
        }
}
}
}
}
return 1;
}
Cambio_Operacione
2
Rookie
20. Maj 2021.
Nastavio je sa problemom, nenoramlnom brzinom izbacuje u logu error i neprestaje dok nezatvorim
ivan221
5
Made Man
🔥3
20. Maj 2021.
Cambio_Operacione wrote on May 20, 2021, 12:48 pm:
Nastavio je sa problemom, nenoramlnom brzinom izbacuje u logu error i neprestaje dok nezatvorim
Ubaci crashdetect i compiluj sa -d3 parametrom pa salji sta izbacuje u logu
Cambio_Operacione
2
Rookie
20. Maj 2021.
PazzOnee wrote on May 20, 2021, 12:49 pm:
Ubaci crashdetect i compiluj sa -d3 parametrom pa salji sta izbacuje u logu

[14:59:04] Long callback execution detected (hang or performance issue)
[14:59:04] AMX backtrace:
[14:59:04] #0 00009580 in public AMX_OnScriptInit () in cshp.amx
[14:59:04] #1 00007578 in public Debug_OnScriptInit () in cshp.amx
[14:59:04] #2 00006f48 in public YVers_OnScriptInit () in cshp.amx
[14:59:04] #3 000066d0 in public ScriptInit_OnScriptInit () in cshp.amx
[14:59:04] #4 000063e4 in public SSCANF_OnGameModeInit () in cshp.amx
[14:59:04] #5 00000754 in public OnGameModeInit () in cshp.amx

[15:02:12] AMX backtrace:
[15:02:12] #0 0069c8f4 in public Autorepair () in cshp.amx
[15:02:13] Run time error 4: "Array index out of bounds"
[15:02:13]   Attempted to read/write array element at index 845 in array of size 50
[15:02:13] AMX backtrace:
[15:02:13] #0 0069c8f4 in public Autorepair () in cshp.amx
[15:02:13] Long callback execution detected (hang or performance issue)
[15:02:13] AMX backtrace:
[15:02:13] #0 00015510 in ?? (0, 33305840, 35089312) in cshp.amx
[15:02:13] #1 00015e44 in ?? (0, 33305840, 0, 6) in cshp.amx
[15:02:13] #2 004424f4 in ?? (0) in cshp.amx
[15:02:13] #3 0046f70c in public ppb_OnPlayerDisconnect (0, 1) in cshp.amx
[15:02:13] #4 000250c4 in public CB_OnPlayerDisconnect (0, 1) in cshp.amx
[15:02:13] #5 0001a908 in public Itter_OnPlayerDisconnect (0, 1) in cshp.amx
[15:02:13] #6 000181c0 in ?? (0, 1) in cshp.amx
[15:02:13] #7 0000bee8 in public SSCANF_OnPlayerDisconnect (0, 1) in cshp.amx
[15:02:13] #8 00000868 in public OnPlayerDisconnect (0, 1) in cshp.amx
ivan221
5
Made Man
🔥3
20. Maj 2021.
daj mi anydesk u pm
Fergosonn
4
Made Man
20. Maj 2021.
public OnPlayerUpdate(playerid)
{
    if(AdminDuty == 1)
{
if(IsPlayerInAnyVehicle(playerid))
{
new Float:HP;
GetVehicleHealth(GetPlayerVehicleID(playerid), HP);
if(HP < 999.0)
{
RepairVehicle(GetPlayerVehicleID(playerid));
SetVehicleHealth(GetPlayerVehicleID(playerid), 999.0);
}
}
}
return 1;
}
Garadooo
5
Forum Don
20. Maj 2021.
Jeste li bolesni?
Provjeravati da li je neko u vozilu svake sekunde?
Fergosonn
4
Made Man
20. Maj 2021.
Galardo wrote on May 20, 2021, 2:30 pm:
Jeste li bolesni?
Provjeravati da li je neko u vozilu svake sekunde?

Skonto sam da je glupo cim sa napisao

Morate biti prijavljeni da biste odgovorili na ovu temu.

Prijava

© 2026 SmartShark. All rights reserved.

Powered by Momentum|v2026.3.001 Alpha