Mal grob aus der Hüfte geschossen:
Klatsche einen Killed-EH an die Fahrzeuge.
this addeventhandler ["Killed", { (_this select 0) execVM "newcar.sqf"}];
Code:
_cartype [B]= [/B]typeof _this;
_dir = getdir _this;
_pos = getPosATL _this;
sleep (2*60); //--- wartet 2 Minuten
deleteVehicle _this;
waitunitil {isnull _this};
//--- neues Fahrzeug setzen
_newcar = createVehicle [_cartype, _pos, [],0,"CAN_COLLIDE"];
_newcar setdir _dir;
_newcar addeventhandler ["Killed", { (_this select 0) execVM "newcar.sqf"}];
Die Variable _newcar ist local. Du kannst sonst nichts weiter damit anstellen. Wichtig, falls ihr die Karre wegnehmt (es geht ja offensichtlich um eine Life-Geschichte)
Alternaiv kannst du auch mit Variablen arbeiten bzw. ein Gamelogic. Je nachdem was du brauchst.
EH fürs Auto: this addeventhandler ["Killed", { (_this select 0) spawn dofrespawn} ];
Variable in der Gamelogic. So kennt der Server und die Clienten die Variable. EH wird local ausgefürht, also je nachdem, wer der "Besitzer" des Fahreuges ist
Code:
dofrespawn = {
_cartype = typeof _this;
_dir = getdir _this;
_pos = getPosATL _this;
sleep (2*5);
deleteVehicle _this;
waituntil {isnull _this};
_newcar = createVehicle [_cartype, _pos, [],0,"CAN_COLLIDE"];
_newcar setdir _dir;
_newcar addeventhandler ["Killed", {(_this select 0) spawn dofrespawn}]; };