'OnVehicleDestroy' question.
#1

I'd like to ask if there is a function like 'OnVehicleDestroy', because I am working on a vehicle system. You can save the car color and position. If the file will be modified and the car respawn, it won't spawn at the saved position but the old position, and the car color doesn't save. The vehicle will only spawn with the saved position and color if the server gets rebooted.

I'm using CreateVehicle to spawn the vehicle.

I hope you can help me. Thanks
Reply
#2

https://sampwiki.blast.hk/wiki/OnVehicleDeath
OnVehicleDeath. If you want it when you destroy a vehicle with "DestroyVehicle" you'll have to make your own function and call it everytime you use "DestroyVehicle".
Reply
#3

Thanks.

I guess my idea didn't work.

No errors, it just doesn't spawn the saved data until the server rebooted:

pawn Код:
public OnVehicleDeath(vehicleid)
{
    for(new i; i < sizeof(COwnerData); i++)
    {
        if(vehicleid == COwnerData[i][CarID])
        {
            DestroyVehicle(COwnerData[i][CarID]);
            COwnerData[i][CarID] = CreateVehicle(COwnerData[i][ModelID], COwnerData[i][carX], COwnerData[i][carY], COwnerData[i][carZ], COwnerData[i][carRot], COwnerData[i][pC1], COwnerData[i][sC2], 30*10000);
        }
    }
return 1;
}
Reply
#4

I don't get it, why doesn't it load the new stuff.

edit: oops, meant to edit.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)