View difference between Paste ID: njuCHrqe and H0KLjgKu
SHOW: | | - or go back to the newest paste.
1
private ["_worldspace","_charID","_veh","_activatingPlayer","_location","_isOk","_vehtospawn","_dir","_helipad","_removed","_keyColor","_keyNumber","_keySelected","_isKeyOK","_config"];
2
 _vehtospawn = _this select 0; 
3
 _activatingPlayer = player;
4
 _charID = dayz_characterID;
5
 _dir = getdir vehicle player;
6
 _pos = getPos vehicle player;
7
 _pos = [(_pos select 0)+8*sin(_dir),(_pos select 1)+8*cos(_dir),0];
8
 _worldspace = [_dir,_pos];
9
 
10
cutText ["Starting Spawn...", "PLAIN DOWN"];
11
 
12
// First select key color
13
_keyColor = ["Green","Red","Blue","Yellow","Black"] call BIS_fnc_selectRandom;
14
 
15
// then select number from 1 - 2500
16
_keyNumber = (floor(random 2500)) + 1;
17
 
18
// Combine to key (eg.ItemKeyYellow2494) classname
19
_keySelected = format[("ItemKey%1%2"),_keyColor,_keyNumber]; 
20
 
21
_isKeyOK =  isClass(configFile >> "CfgWeapons" >> _keySelected);
22
 
23
_config = _keySelected;
24
_isOk = [player,_config] call BIS_fnc_invAdd;
25
waitUntil {!isNil "_isOk"};
26
if (_isOk and _isKeyOK) then {
27
 
28
//	_removed = ([player,_part_in,_qty_in] call BIS_fnc_invRemove);
29
	_dir = round(random 360); 
30
	_helipad = nearestObjects [player, ["HeliHCivil","HeliHempty"], 100];
31
32
	if(count _helipad > 0) then {
33
		_location = (getPosATL (_helipad select 0));
34
	} else {
35
		_location = position player findEmptyPosition [0,15,_vehtospawn];
36
	};
37
	
38-
	if(_location != []) then {
38+
	//place vehicle spawn marker (local)
39-
		//place vehicle spawn marker (local)
39+
	_veh = createVehicle ["Sign_arrow_down_large_EP1", _location, [], 0, "CAN_COLLIDE"]; 
40-
		_veh = createVehicle ["Sign_arrow_down_large_EP1", _location, [], 0, "CAN_COLLIDE"]; 
40+
	_location = (getPosATL _veh);
41-
		_location = (getPosATL _veh);
41+
42
	PVDZE_veh_Publish2 = [_veh,[_dir,_location],_vehtospawn,false,_keySelected,_activatingPlayer];
43-
		PVDZE_veh_Publish2 = [_veh,[_dir,_location],_vehtospawn,false,_keySelected,_activatingPlayer];
43+
	publicVariableServer  "PVDZE_veh_Publish2";
44-
		publicVariableServer  "PVDZE_veh_Publish2";
44+
	player reveal _veh;
45-
		player reveal _veh;
45+
	 
46
	cutText ["Vehicle spawned, key added to toolbelt.", "PLAIN DOWN"];
47-
		cutText ["Vehicle spawned, key added to toolbelt.", "PLAIN DOWN"];
47+
48
	cutText ["Your toolbelt is full.", "PLAIN DOWN"];
49-
		cutText ["Could not find an area to spawn vehicle.", "PLAIN DOWN"];
49+