SA-MP Forums Archive
Respawning vehicles messes up their variables. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Respawning vehicles messes up their variables. (/showthread.php?tid=614978)



Respawning vehicles messes up their variables. - Dokins - 15.08.2016

pawn Код:
CMD:respawnallvehicles(playerid, params[])
{
    if(LoggedIn[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command.");
    if(AdminLevel[playerid] < 1) return SendClientMessage(playerid, COLOUR_GREY, "You are not authorized to use this command.");
    new string[128];
    for(new v = 1; v  < GetVehiclePoolSize()+1; v++)
    {
        if(GetVehicleModel(v) != 510 && !IsVehicleInUse(v) && VehicleSQLID[v] > 0)
        {
            DestroyVehicle(v);
            CreateVehicle(VehModel[v], VehSpawnX[v], VehSpawnY[v], VehSpawnZ[v], VehSpawnAngle[v], VehColour1[v], VehColour2[v],0,VehSiren[v]);
            SetVehicleNumberPlate(v, VehPlate[v]);
        }
    }
    format(string, sizeof(string), ""COL_GREEN"All Vehicles Respawned.");
    SendClientMessage(playerid, COLOUR_WHITE, string);
    SendClientMessageToAll(COLOUR_WHITE, "All vehicles have been respawned.");
    return 1;
}
Title says all.

The vehicles tend to have different jobs etc. How do I combat this, if I have deleted a vehicle as well? I'm entirely confused.