Any reason why SetVehicleRespawn could become ridiclously slow?
#1

My vehicle pool is 1475.

pawn Код:
respawnAllVehicles()
{
    new bool:vehicleActivityStatus[MAX_VEHICLES] = {false, ...}, pCurVehicleID = INVALID_VEHICLE_ID;
    foreach(new i : Character)
    {
        if(playerData[i][pCurrentVehicleDrivenID] != INVALID_VEHICLE_ID) {
            pCurVehicleID = playerData[i][pCurrentVehicleDrivenID];
        }
        else if(IsPlayerInAnyVehicle(i)) {
            pCurVehicleID = GetPlayerVehicleID(i);
        }
        if(pCurVehicleID != INVALID_VEHICLE_ID) {
            vehicleActivityStatus[pCurVehicleID] = true;
            if(IsTrailerAttachedToVehicle(pCurVehicleID)) {
                vehicleActivityStatus[GetVehicleTrailer(pCurVehicleID)] = true;
            }
        }
        pCurVehicleID = INVALID_VEHICLE_ID;
    }
    for(new i = 0, j = GetVehiclePoolSize(); i < j; i++) {
        if(IsValidVehicle(i) && vehicleActivityStatus[i] == false) {
            SetVehicleToRespawn(i);
        }
    }
    return;
}
This command takes 15 seconds to execute on my home host, and a few on linux.

I recently added IsValidVehicle(i), that IS NOT slowing it down.

If you remove SetVehicleToRespawn, the loop takes 0 ms. But when you add SetVehicleToRespawn.. idk whats happening man.

This guy complained about the same issue https://sampforum.blast.hk/showthread.php?tid=575688.
Reply


Messages In This Thread
Any reason why SetVehicleRespawn could become ridiclously slow? - by Kar - 20.03.2016, 08:28
Re: Any reason why SetVehicleRespawn could become ridiclously slow? - by xo - 20.03.2016, 16:13
Re: Any reason why SetVehicleRespawn could become ridiclously slow? - by Kar - 20.03.2016, 22:16
Re: Any reason why SetVehicleRespawn could become ridiclously slow? - by rymax99 - 20.03.2016, 22:26
Re: Any reason why SetVehicleRespawn could become ridiclously slow? - by Kar - 21.03.2016, 04:15

Forum Jump:


Users browsing this thread: 1 Guest(s)