Advertisement
Halvhjearne

spawnvehicle.sqf

Dec 24th, 2013
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.55 KB | None | 0 0
  1. // Configuration
  2. _dist = 15; //distance in front of player to land Vehicle
  3.  
  4. // End of configuration
  5.  
  6. #define KINDOF_ARRAY(a,b) [##a,##b] call {_veh = _this select 0;_types = _this select 1;_res = false; {if (_veh isKindOf _x) exitwith { _res = true };}forEach _types;_res}
  7.  
  8. _n2sh = 10;
  9. _n2c = "Select Vehicle:";
  10. selecteditem = "";
  11. shnext = false;
  12. if (isNil "vhnlist") then {
  13.     vhnlist = [];
  14.     _kindOf = ["LandVehicle","Air","Ship"];
  15.     _filter = ["BIS_Steerable_Parachute","ParachuteBase","Steerable_Parachute_EP1"];
  16.     _cfgvehicles = configFile >> "cfgVehicles";
  17.     titleText ["Generating Vehicle list... Wait...","PLAIN DOWN"];titleFadeOut 2;
  18.     for "_i" from 0 to (count _cfgvehicles)-1 do {
  19.             _vehicle = _cfgvehicles select _i;
  20.             if (isClass _vehicle) then {
  21.                 _veh_type = configName(_vehicle);
  22.                 if ((getNumber(_vehicle >> "scope")==2) and (getText(_vehicle >> "picture")!="") and (KINDOF_ARRAY(_veh_type,_kindOf)) and !(KINDOF_ARRAY(_veh_type,_filter))) then {
  23.                 vhnlist set [count vhnlist,_veh_type];
  24.             };
  25.         };
  26.     };
  27.     titleText ["List is ready...","PLAIN DOWN"];titleFadeOut 2;
  28. };
  29.  
  30. shnext = false;
  31.  
  32. shnmenu = {
  33.     _pmenu = [["",true],[_n2c, [-1], "", -5, [["expression", ""]], "1", "0"]];
  34.     for "_i" from (_this select 0) to (_this select 1) do {
  35.         _arr = [format['%1',vhnlist select (_i)], [_i - (_this select 0) + 2],  "", -5, [["expression", format["selecteditem = vhnlist select %1;",_i]]], "1", "1"];
  36.         _pmenu set [_i+2, _arr];
  37.     };
  38.     _pmenu set [(_this select 1)+2, ["", [-1], "", -5, [["expression", ""]], "1", "0"]];
  39.     if (count vhnlist >  (_this select 1)) then {
  40.         _pmenu set [(_this select 1)+3, ["Next", [12], "", -5, [["expression", "shnext = true;"]], "1", "1"]];
  41.     } else {
  42.         _pmenu set [(_this select 1)+3, ["", [-1], "", -5, [["expression", ""]], "1", "0"]];
  43.     };
  44.     _pmenu set [(_this select 1)+4, ["Exit", [13], "", -5, [["expression", "selecteditem = 'exitscript';"]], "1", "1"]];
  45.     showCommandingMenu "#USER:_pmenu";
  46. };
  47.  
  48. _j=0;
  49. if (_n2sh>9) then {_n2sh=10;
  50. };
  51.  
  52. while {selecteditem==""} do {
  53.     [_j,(_j+_n2sh) min (count vhnlist)] call shnmenu;
  54.     _j=_j+_n2sh;
  55.     WaitUntil {
  56.         selecteditem!="" or shnext
  57.     };
  58.     shnext = false;
  59. };
  60.  
  61.  
  62.  
  63.  
  64. if (selecteditem != "exitscript" and selecteditem != "") then {
  65.     _dir = getdir vehicle player;
  66.     _pos = getPos vehicle player;
  67.     _pos = [(_pos select 0)+_dist*sin(_dir),(_pos select 1)+_dist*cos(_dir),0]; // 15 meters infront of player
  68.    
  69.     herp = createVehicle [selecteditem, _pos, [], 0, "CAN_COLLIDE"];
  70.     herp setVariable ["Sarge",1,true];
  71.     clearMagazineCargoGlobal herp;
  72.     clearWeaponCargoGlobal herp;
  73. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement