Einzelnen Beitrag anzeigen
Alt 07.11.2009, 05:39   #3 (permalink)
Bowi
Newbie
 
Registriert seit: 07.11.2009
Beiträge: 37
Standard

Sorry das ist der Code von dem Respawn Script...........dachte es reicht wenn schreibe von wem es ist
......man lern nie aus
Code:
if (!isServer) exitWith {};


// Define the variables
_unit = _this select 0;
_delay = _this select 1;
_deserted = _this select 2;
_respawns = _this select 3;
_explode = _this select 4;
_dynamic = _this select 5;

_noend = true;
_run = true;
_rounds = 0;

// Respawn delay - Default 30 seconds.
if (isNil ("_delay")) then {_delay = 30} else {_delay = _delay};
if (_delay < 0) then {_delay = 0};

// Desertion timer - default 120 seconds.
if (isNil ("_deserted")) then {_deserted = 120} else {_deserted = _deserted};
if (_deserted < 0) then {_deserted = 0};

// Number of rspawns - default infinite.
if (isNil ("_respawns")) then {_respawns= 0; _noend = true;} else {_respawns= _respawns; _noend = false;};
if (_respawns <= 0) then {_respawns= 0; _noend = true;};

// Respawn effect - default off.
if (isNil ("_explode")) then {_explode = false} else {_explode = _explode};

// Dynamic respawn - default off.
if (isNil ("_dynamic")) then {_dynamic = false} else {_dynamic = _dynamic};


_dir = getDir _unit;
_position = getPosASL _unit;
_type = typeOf _unit;
_dead = false;
_nodelay = false;


// Start monitoring the vehicle
while {_run} do 
{    
    sleep (2 + random 12);
      if ((getDammage _unit > 0.8) and ({alive _x} count crew _unit == 0)) then {_dead = true};

    // Check if the vehicle is deserted.
    if ((getPosASL _unit distance _position > 10) and ({alive _x} count crew _unit == 0)) then 
    {
        _timeout = time + _deserted;
        waitUntil {_timeout < time or {alive _x} count crew _unit > 0};
        if ({alive _x} count crew _unit > 0) then {_dead = false;}; 
        if ({alive _x} count crew _unit == 0) then {_dead = true; _nodelay =true;}; 
    };


    // Respawn vehicle
      if (_dead) then 
    {    
        if (_nodelay) then {sleep 0.1; _nodelay = false;} else {sleep _delay};
        if (_dynamic) then {_position = getPosASL _unit; _dir = getDir _unit;};
        if (_explode) then {_effect = "M_TOW_AT" createVehicle getPosASL _unit; _effect setPosASL getPosASL _unit;};
        sleep 0.1;

        deleteVehicle _unit;
        sleep 2;
        _unit = _type createVehicle _position;
        _unit setPosASL _position;
        _unit setDir _dir;
        _dead = false;

        // Check respawn amount
        if !(_noend) then {_rounds = _rounds + 1};
        if ((_rounds == _respawns) and !(_noend)) then {_run = false;};
    };
};
Bowi ist offline