Balkan SA:MP

PAWN skriptanje, gamemodovi, filterskripte, include fajlovi, mape, pluginovi => Razgovor u vezi PAWN - skriptanja => Temu započeo: Cambio_Operacione poslato Maj 20, 2021, 14:26:28 POSLE PODNE

Naslov: Run time error 4
Poruka od: Cambio_Operacione poslato Maj 20, 2021, 14:26:28 POSLE PODNE
Problem(error/warning): Svaki autorepair izbaci u logu ovo

Deo skripte:

forward Autorepair();
public Autorepair()
{
    for(new i = 0; i <MAX_PLAYERS; i++)
    {
    if(AdminDuty[i])
    {
        if(PlayerInfo[i][xAdmin] >= 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] [debug] AMX backtrace:
[13:55:46] [debug] #0 0069c8a4 in public Autorepair () from cshp.amx
[13:55:46] [debug] Run time error 4: "Array index out of bounds"
[13:55:46] [debug]  Accessing element at index 311 past array upper bound 49
Naslov: Odg: Run time error 4
Poruka od: PazzOnee poslato Maj 20, 2021, 14:40:09 POSLE PODNE
[pawn]forward Autorepair();
public Autorepair()
{
    for(new i = 0; i <MAX_PLAYERS; i++)
    {
       if(IsPlayerConnected(i))
       {
          if(AdminDuty)
          {
              if(PlayerInfo[xAdmin] >= 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;
}[/pawn]
Naslov: Odg: Run time error 4
Poruka od: Cambio_Operacione poslato Maj 20, 2021, 14:48:28 POSLE PODNE
Nastavio je sa problemom, nenoramlnom brzinom izbacuje u logu error i neprestaje dok nezatvorim
Naslov: Odg: Run time error 4
Poruka od: PazzOnee poslato Maj 20, 2021, 14:49:43 POSLE PODNE
Citat: Cambio_Operacione poslato Maj 20, 2021, 14:48:28 POSLE PODNE
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
Naslov: Odg: Run time error 4
Poruka od: Cambio_Operacione poslato Maj 20, 2021, 15:03:18 POSLE PODNE
Citat: PazzOnee poslato Maj 20, 2021, 14:49:43 POSLE PODNE
Ubaci crashdetect i compiluj sa -d3 parametrom pa salji sta izbacuje u logu
[14:59:04] [debug] Long callback execution detected (hang or performance issue)
[14:59:04] [debug] AMX backtrace:
[14:59:04] [debug] #0 00009580 in public AMX_OnScriptInit () in cshp.amx
[14:59:04] [debug] #1 00007578 in public Debug_OnScriptInit () in cshp.amx
[14:59:04] [debug] #2 00006f48 in public YVers_OnScriptInit () in cshp.amx
[14:59:04] [debug] #3 000066d0 in public ScriptInit_OnScriptInit () in cshp.amx
[14:59:04] [debug] #4 000063e4 in public SSCANF_OnGameModeInit () in cshp.amx
[14:59:04] [debug] #5 00000754 in public OnGameModeInit () in cshp.amx



[15:02:12] [debug] AMX backtrace:
[15:02:12] [debug] #0 0069c8f4 in public Autorepair () in cshp.amx
[15:02:13] [debug] Run time error 4: "Array index out of bounds"
[15:02:13] [debug]  Attempted to read/write array element at index 845 in array of size 50
[15:02:13] [debug] AMX backtrace:
[15:02:13] [debug] #0 0069c8f4 in public Autorepair () in cshp.amx
[15:02:13] [debug] Long callback execution detected (hang or performance issue)
[15:02:13] [debug] AMX backtrace:
[15:02:13] [debug] #0 00015510 in ?? (0, 33305840, 35089312) in cshp.amx
[15:02:13] [debug] #1 00015e44 in ?? (0, 33305840, 0, 6) in cshp.amx
[15:02:13] [debug] #2 004424f4 in ?? (0) in cshp.amx
[15:02:13] [debug] #3 0046f70c in public ppb_OnPlayerDisconnect (0, 1) in cshp.amx
[15:02:13] [debug] #4 000250c4 in public CB_OnPlayerDisconnect (0, 1) in cshp.amx
[15:02:13] [debug] #5 0001a908 in public Itter_OnPlayerDisconnect (0, 1) in cshp.amx
[15:02:13] [debug] #6 000181c0 in ?? (0, 1) in cshp.amx
[15:02:13] [debug] #7 0000bee8 in public SSCANF_OnPlayerDisconnect (0, 1) in cshp.amx
[15:02:13] [debug] #8 00000868 in public OnPlayerDisconnect (0, 1) in cshp.amx
Naslov: Odg: Run time error 4
Poruka od: PazzOnee poslato Maj 20, 2021, 15:07:13 POSLE PODNE
daj mi anydesk u pm
Naslov: Odg: Run time error 4
Poruka od: Fergosonn poslato Maj 20, 2021, 16:26:00 POSLE PODNE
[pawn]public OnPlayerUpdate(playerid)
{
    if(AdminDuty[playerid] == 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;
}[/pawn]
Naslov: Odg: Run time error 4
Poruka od: Galardo poslato Maj 20, 2021, 16:30:07 POSLE PODNE
Jeste li bolesni?
Provjeravati da li je neko u vozilu svake sekunde?
Naslov: Odg: Run time error 4
Poruka od: Fergosonn poslato Maj 20, 2021, 16:33:12 POSLE PODNE
Citat: Galardo poslato Maj 20, 2021, 16:30:07 POSLE PODNE
Jeste li bolesni?
Provjeravati da li je neko u vozilu svake sekunde?
Skonto sam da je glupo cim sa napisao