Jump to content

Buck0

Member
  • Posts

    521
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by Buck0

  1. both times, spawned on ground

     

    to confirm, this is the code i have used

    private ["_Missing","_index","_SpawnPats","_helipadsnear","_nearestpad","_veh","_vehicle","_key","_vehname","_position","_checkkey","_sign"];
    _index = _this select 0;
    if (_index < 0) exitWith {cutText["\n\nNo Vehicle selected!","PLAIN DOWN"]};
    
    _veh = VehStoredList select _index;
    _vehicle = _veh select 0;
    _key = _veh select 1;
    _Missing = "";
    _vehname = getText(configFile >> "cfgVehicles" >> (_vehicle select 0) >> "displayName");
    
    if (_vehicle select 0 isKindOf 'Air') then {
    _SpawnPats = ["Sr_border"];
    _Missing = "Helipad";
    } else {
    _SpawnPats = ["HeliHCivil"];
    _Missing = "Parking Lot";
    };
    
    _helipadsnear = nearestObjects [(getPosATL player),_SpawnPats,50];
    if ((count _helipadsnear) < 1) exitWith {cutText["\n\nYou need a "+_Missing+"! Right click on your Toolbox to build one!","PLAIN DOWN"]};
    
    _nearestpad = _helipadsnear select 0;
    _position = getPos _nearestpad;
    _location = [_position select 0, _position select 1, _position select 2];
    
    _checkkey = [player,_key] call BIS_fnc_invAdd;
    if (!(_checkkey)) exitWith {cutText [(localize "str_epoch_player_107"),"PLAIN DOWN"]};
    
    _sign = createVehicle ["Sign_arrow_down_large_EP1",_position,[],0,"CAN_COLLIDE"];
    
    PVDZE_veh_spawn = [player,_vehicle,_sign,VirtualGarage];
    publicVariableServer "PVDZE_veh_spawn";
    
    cutText [format["\n\nYou have successfully spawned a %1, %2 has been added to your toolbelt.",_vehname,getText(configFile >> "CfgWeapons" >> _key >> "displayName")],"PLAIN DOWN"];
    
    sleep 2;
    call garage_getnearVeh;
    call garage_getstoredVeh;
    
  2. Wouldnt something like this be better? As its a defined spawn point

    //Overwrite first assignment, if SR_border

    {

    if (typeOf _x == "SR_border") exitWith {_nearestpad = _x;_SRborder = true;};

    } count _helipadsnear;

    if (_SRBorder) then {

    _getPosATL = getPosATL _nearestpad;

    //Spawn a tiny bit above the S_ border, to avoid glitching.

    _position = [(_getPosATL select 0),(_getPosATL select 1),((_getPosATL select2)+0.2))];

    } else {

    _position = getPosATL _nearestpad;

    };

  3. Something i was given a LONG time ago

    private ["_obj"];
         
        _CrackTime = 180; // Time in seconds it takes to crack a safe.
        _CrackOdds = 20; // Percent chance out of 100 to crack the safe.
         
        // ------- CONFIG END -------
        _ctTool = {_x == "ItemToolbox"} count items player;
        _ctCrow = {_x == "ItemCrowbar"} count items player;
        _ctWire = {_x == "ItemHotwireKit"} count magazines player;
    	_obj = _this select 3;
    	{player removeAction _x} forEach s_player_combi;s_player_combi = [];
        if ((_ctTool == 0) || (_ctCrow == 0) || (_ctWire == 0)) exitWith {cutText [format["You need a toolbox, crowbar, and hotwire kit to crack a safe."], "PLAIN DOWN"];};
        if ((_ctTool > 0) && (_ctCrow > 0) && (_ctWire > 0)) then
        {
                startcracking = true;
    			player playActionNow "Medic";
                _dis=10;
                _sfx = "";
                [player,_sfx,0,false,_dis] call dayz_zombieSpeak;
                [player,_dis,true,(getPosATL player)] spawn player_alertZombies;
    			DZE_ActionInProgress = true;
                r_interrupt = false;
                _animState = animationState player;
                r_doLoop = true;
                _started = false;
                _finished = false;
    			_overallTime = time;
                while {r_doLoop} do
                {		[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
                        _animState = animationState player;
                        _isMedic = ["medic",_animState] call fnc_inString;
                        if (_isMedic) then
                        {
                                _started = true;
                        };
                        if(!_isMedic && !r_interrupt && (time - _overallTime) < _CrackTime) then
                        {
                                player playActionNow "Medic";
                                _isMedic = true;
                        };
                        if (_started && !_isMedic && (time - _overallTime) > _CrackTime) then
                        {
                                r_doLoop = false;
                                _finished = true;
                                lastBloodbag = time;
                        };
                        if (r_interrupt) then
                        {
                                r_doLoop = false;
                        };
                        sleep 0.1;
                };
               
                if (_finished) then
                {
                        if ((round(random 100)) < _CrackOdds) then
                        {
    						dayz_combination = _obj getVariable["CharacterID","0"];
    						dayz_selectedVault = _obj;
    						_obj spawn player_unlockVault;
    						player removeMagazine "ItemHotwireKit";
    						cutText [format["You have cracked the safe!"], "PLAIN DOWN"];
    						DZE_ActionInProgress = false;
    						startcracking = false;
                        }else{
    						cutText [format["You have failed to cracked the safe!"], "PLAIN DOWN"];
    						player removeMagazine "ItemHotwireKit";
    						DZE_ActionInProgress = false;
    						startcracking = false;
    					};
                } else {
                        r_interrupt = false;
                        player switchMove "";
                        player playActionNow "stop";
                        cutText [format["You have stopped cracking the safe!"], "PLAIN DOWN"];
    					startcracking = false;
    					DZE_ActionInProgress = false;
                };
        };
    
×
×
  • Create New...