DestroyVehicle and 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: DestroyVehicle and Variables (
/showthread.php?tid=363830)
DestroyVehicle and Variables -
Tee - 28.07.2012
I'm having a problem where vehicle IDs get mixed up (well I think so). It just came to me that when you create a vehicle that's stored in an array, then destroy the vehicle, the vehicle ID would still be in that array (then maybe later, cause conflicts)
Example:
pawn Код:
PlayerData[playerid][Vehicle] = CreateVehicle(...);
//somewhere later...
DestroyVehicle(PlayerData[playerid][Vehicle]);//vehicle gets destroyed...but what happens to the variable?
//do I initialize it to zero? (PlayerData[playerid][Vehicle] = 0;)?
Does the function "DestroyVehicle" ONLY remove the vehicle from the server, or initialize the variable it was stored in, to zero?
Re: DestroyVehicle and Variables -
Kindred - 28.07.2012
I'd think it only removes the vehicle from the server. If you want to test this, simply print the value of the variable after you use DestroyVehicle (should be possible).
Re: DestroyVehicle and Variables -
SuperViper - 28.07.2012
It doesn't reset the variable. None of the default SA:MP functions do, you'll need to do it yourself.
Re: DestroyVehicle and Variables -
Tee - 28.07.2012
After all this time I just stumbled up on this idea -_- but thanks anyway