Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* [EVO] Dan's vehicle respawn script modified by Steam-User immerfestedruv
- In the Unit Init Field insert <0 = [this,5] execVM "vehicle_respawn.sqf";> for example.
- Will run only on the server, as it only needs to run in one place,
- but obviously can be used in both singleplayer and multiplayer */
- _veh = _this select 0; // First Argument, get vehicle's details
- _delay = _this select 1; // Second Argument, get the init set respawn time
- _dirOfVeh = getDir _veh; // get original facing
- _posOfVeh = getPosATL _veh; // get original position
- _vehtype = typeOf _veh; // get the vehicle type
- _vehName = vehicleVarName _veh; // get the Variable-Name from the Vehicle
- _n = 1;
- if(isServer) then{
- while{_n == 1} do{
- sleep 12; // sleep for a bit in order to reduce processing calls
- if((!alive _veh) || (!canMove _veh)) then { //true if vehicle is not alive or it cannot move
- deleteVehicle _veh; //clear up old vehicle
- sleep _delay; // delay between deletion and respawn
- _veh = _vehtype createVehicle _posOfVeh; // create a new vehicle of same type at starting position
- _veh setPosATL _posOfVeh; //set correct position
- _veh setDir _dirOfVeh; //set correct facing of the vehicle
- _veh setVehicleVarName _vehName;
- /* Next Code-Line will be executed for the new Object by your CPU, but time of execution unkown.
- This behaves similar to the code in the init-field of your object. */
- [[[_veh,_delay],"vehicle_respawn.sqf"],"BIS_fnc_execVM",false,false] spawn BIS_fnc_MP;
- _n = 0; // break out condition
- };
- //hint format ["%2 ist bei %1.",_posOfVeh,_vehName];
- };
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement