ChangeVehicleColor and SetVehicleToRespawn - 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: ChangeVehicleColor and SetVehicleToRespawn (
/showthread.php?tid=616674)
ChangeVehicleColor and SetVehicleToRespawn -
thefirestate - 08.09.2016
Well, recently I noticed that when a vehicle is resprayed the 2 colors are indeed saved but when respawned the vehicle's color came back to the ones used with CreateVehicle. I came up with 2 solutions using ChangeVehicleColor after SetVehicleToRespawn and assigning it the color from the variable which contains it or when someone actually tries to respray his vehicle I would have to completely recreate it. I think the first one is much better but, my question is, is that SA-MP bug? Is it something I did wrong? Like in order to respawn with the new color I should return a specific value in a callback or?
Re: ChangeVehicleColor and SetVehicleToRespawn -
SickAttack - 08.09.2016
That's normal, and how it should work. If you want resprays to be permanent, then create a variable, when you respray a vehicle save the color in the variable, and in the callback OnVehicleSpawn, change the color of the vehicle to the color in the variable.
Re: ChangeVehicleColor and SetVehicleToRespawn -
thefirestate - 08.09.2016
Right, never thought of OnVehicleSpawn would be a global workaround. I already have a variable saving all vehicle information. On the first thought, I was thinking about making all commands execute ChangeVehicleColor(someid, myvar[someid][c1], myvar[someid][c2]) after SetVehicleToRespawn but your idea is even better. Thanks mate <3