DestroyVehicle and Variables
#1

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?
Reply
#2

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).
Reply
#3

It doesn't reset the variable. None of the default SA:MP functions do, you'll need to do it yourself.
Reply
#4

After all this time I just stumbled up on this idea -_- but thanks anyway
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)