Advertisement
Guest User

addvehicle.sqf

a guest
Jul 4th, 2014
287
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.89 KB | None | 0 0
  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 {
  39. //place vehicle spawn marker (local)
  40. _veh = createVehicle ["Sign_arrow_down_large_EP1", _location, [], 0, "CAN_COLLIDE"];
  41. _location = (getPosATL _veh);
  42.  
  43. PVDZE_veh_Publish2 = [_veh,[_dir,_location],_vehtospawn,false,_keySelected,_activatingPlayer];
  44. publicVariableServer "PVDZE_veh_Publish2";
  45. player reveal _veh;
  46.  
  47. cutText ["Vehicle spawned, key added to toolbelt.", "PLAIN DOWN"];
  48. } else {
  49. cutText ["Could not find an area to spawn vehicle.", "PLAIN DOWN"];
  50. };
  51. } else {
  52. cutText ["Your toolbelt is full.", "PLAIN DOWN"];
  53. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement