Any reason why SetVehicleRespawn could become ridiclously slow? -
Kar - 20.03.2016
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.
Re: Any reason why SetVehicleRespawn could become ridiclously slow? -
xo - 20.03.2016
I'm not sure, but i usually do respawn ~400 vehicles once smoothly, do you have any kind of heavy stuff under onvehiclespawn?
Re: Any reason why SetVehicleRespawn could become ridiclously slow? -
Kar - 20.03.2016
Wow I think thats it. I didn't even think about that.
Thank you.
Lol this can be trashed!
Re: Any reason why SetVehicleRespawn could become ridiclously slow? -
rymax99 - 20.03.2016
Or it can stay here for others that may experience this.
Re: Any reason why SetVehicleRespawn could become ridiclously slow? -
Kar - 21.03.2016
Don't set number plates under OnVehicleSpawn.
I realized that once you set a number plate on creation, you don't have to set it again when it respawns / dies. I thought so, but I didn't know.