Jump to content

Recommended Posts

Hi,

i got following script :

 

 

_veh = "B_T_LSV_01_unarmed_olive_F" createVehicle position player;
_veh setVariable ["BIS_enableRandomization", false];
_veh setDir _direction;
_veh setPos _position;
clearWeaponCargoGlobal _veh;
clearMagazineCargoGlobal _veh;
clearItemCargoGlobal _veh;
player moveInDriver _veh;

 

it spawns a vehicle and moves the player inside, what i want now is a script that delets the vehicle if i exec this script again, so if i exec this script again it delets my first vehicle form the script and spawns a new, so that every player got only 1 vehicle on map!.

 

Thx for your help!

Share this post


Link to post
Share on other sites

No need for a second script:
 

_previousVeh = missionNamespace getVariable ["TAG_scriptCreatedVeh",objnull];
if !(isNull _previousVeh) then {deleteVehicle _previousVeh};

_veh = "B_T_LSV_01_unarmed_olive_F" createVehicle position player;
_veh setVariable ["BIS_enableRandomization", false];
_veh setDir _direction;
_veh setPos _position;
clearWeaponCargoGlobal _veh;
clearMagazineCargoGlobal _veh;
clearItemCargoGlobal _veh;
player moveInDriver _veh; 

missionNamespace setVariable ["TAG_scriptCreatedVeh",_veh];

 

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×