Advertisement
Guest User

Untitled

a guest
Aug 31st, 2015
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.06 KB | None | 0 0
  1. /*
  2. File: fn_copLights.sqf
  3. Author: [GSN] Pager & [GSN] Paronity
  4. Website: GSNGaming.com
  5. Date Created: 2.24.2015
  6. Date Modified: 3.3.2015 v1.3
  7. */
  8.  
  9. private ["_veh","_lightRed","_lightWhite","_lightBlue","_lightsOn","_brightnessHigh","_brightnessLow","_attach","_leftLights","_rightLights","_type","_attenuation"];
  10.  
  11. _veh = (_this select 0);
  12. _type = typeOf _veh;
  13. _sun = (sunOrMoon < 1);
  14.  
  15. if (isNil "_veh" || isNull _veh || !(_veh getVariable "lights")) exitWith {};
  16.  
  17. _lightRed = [255, 0, 0];
  18. _lightWhite = [255, 255, 255];
  19. _lightBlue = [0, 0, 255];
  20.  
  21. if (_sun) then
  22. {
  23. _brightnessLow = 0;
  24. _brightnessHigh = 10;
  25. _attenuation = [0.001, 3000, 0, 125000];
  26. } else {
  27. _brightnessLow = 0;
  28. _brightnessHigh = 60;
  29. _attenuation = [0.001, 3000, 0, 500000];
  30. };
  31.  
  32. _flashes = 3;
  33. _flashOn = 0.1;
  34. _flashOff = 0.001;
  35.  
  36. _leftLights = [];
  37. _rightLights = [];
  38.  
  39. _attach =
  40. {
  41. _isLight = _this select 0;
  42. _color = _this select 1;
  43. _position = _this select 2;
  44. _light = "#lightpoint" createVehicleLocal getPos _veh;
  45. _light setLightBrightness 0;
  46. _light setLightAmbient [0,0,0];
  47. _light setLightAttenuation _attenuation;
  48. _light setLightIntensity 1000;
  49. _light setLightFlareSize 1;
  50. _light setLightFlareMaxDistance 150;
  51. _light setLightUseFlare true;
  52. _light setLightDayLight true;
  53.  
  54. switch (_color) do
  55. {
  56. case "red": { _light setLightColor _lightRed; };
  57. case "white": { _light setLightColor _lightWhite; };
  58. case "blue": { _light setLightColor _lightBlue; };
  59. };
  60.  
  61. if (_isLight) then
  62. {
  63. _leftLights pushBack [_light, _position];
  64. } else {
  65. _rightLights pushBack [_light, _position];
  66. };
  67.  
  68. _light lightAttachObject [_veh, _position];
  69. };
  70.  
  71. switch (_type) do
  72. {
  73. case "C_Offroad_01_F":
  74. {
  75. [false, "red", [-0.44, 0, 0.525]] call _attach;
  76. [true, "blue", [0.345, 0, 0.525]] call _attach;
  77. [false, "red", [0.575, -2.95, -0.77]] call _attach;
  78. [true, "blue", [-0.645, -2.95, -0.77]] call _attach;
  79. [false, "white", [0.61, 2.2825, -0.355]] call _attach;
  80. [true, "white", [-0.695, 2.2825, -0.355]] call _attach;
  81. };
  82.  
  83. case "C_SUV_01_F":
  84. {
  85. [false, "red", [-0.39, 2.28, -0.52]] call _attach;
  86. [true, "blue", [0.38, 2.28, -0.52]] call _attach;
  87. [false, "red", [-0.86, -2.75, -0.18]] call _attach;
  88. [true, "blue", [0.86, -2.75, -0.18]] call _attach;
  89. [false, "white", [0.8, 1.95, -0.48]] call _attach;
  90. [true, "white", [-0.8, 1.95, -0.48]] call _attach;
  91.  
  92. };
  93.  
  94. case "C_Hatchback_01_sport_F":
  95. {
  96. [false, "red", [-0.03, -0, 0.2]] call _attach;
  97. [true, "blue", [-0.03, -0, 0.2]] call _attach;
  98. [false, "red", [-0.8, -2.25, -0.3]] call _attach;
  99. [true, "blue", [0.78, -2.25, -0.3]] call _attach;
  100. [false, "white", [0.75, 1.615, -0.52]] call _attach;
  101. [true, "white", [-0.8, 1.615, -0.525]] call _attach;
  102. };
  103.  
  104. case "C_Hatchback_01_F":
  105. {
  106. [false, "red", [-0.03, -0, 0.2]] call _attach;
  107. [true, "blue", [-0.03, -0, 0.2]] call _attach;
  108. [false, "red", [-0.8, -2.25, -0.3]] call _attach;
  109. [true, "blue", [0.78, -2.25, -0.3]] call _attach;
  110. [false, "white", [0.75, 1.615, -0.52]] call _attach;
  111. [true, "white", [-0.8, 1.615, -0.525]] call _attach;
  112. };
  113.  
  114. case "B_MRAP_01_F":
  115. {
  116. [false, "red", [-0.85, -0.9, 0.6]] call _attach;
  117. [true, "blue", [0.85, -0.9, 0.6]] call _attach;
  118. [true, "red", [-0.93, -2.8, 0.6]] call _attach;
  119. [false, "blue", [0.93, -2.8, 0.6]] call _attach;
  120. [true, "white", [-0.85, 1.475, -0.75]] call _attach;
  121. [false, "white", [0.85, 1.475, -0.75]] call _attach;
  122. };
  123.  
  124. case "I_MRAP_03_F":
  125. {
  126. [true, "red", [-0.87, 2.2, -0.75]] call _attach;
  127. [false, "blue", [0.87, 2.2, -0.75]] call _attach;
  128.  
  129. [false, "blue", [1.10, -0.55, 0.5]] call _attach;
  130. [true, "red", [-1.10, -0.55, 0.5]] call _attach;
  131.  
  132. [false, "white", [-1.05, 2.25, -0.3]] call _attach;
  133. [true, "white", [1.05, 2.25, -0.3]] call _attach;
  134.  
  135. [true, "red", [1.225, -2.845, -0.71]] call _attach;
  136. [true, "red", [-0.725, -3.15, 0.025]] call _attach;
  137.  
  138. [false, "blue", [-1.225, -2.845, -0.7]] call _attach;
  139. [false, "blue", [0.725, -3.15, 0.025]] call _attach;
  140. };
  141.  
  142. case "O_MRAP_02_F":
  143. {
  144. [false, "blue", [1.175, -1.5, 0.365]] call _attach;
  145. [true, "red", [-1.175, -1.5, 0.365]] call _attach;
  146.  
  147. [false, "red", [0.4325, -1.5, 0.6275]] call _attach;
  148. [true, "blue", [0.4325, -1.5, 0.6275]] call _attach;
  149.  
  150. [true, "red", [-0.2, 1.575, -1.125]] call _attach;
  151. [false, "blue", [0.2, 1.575, -1.125]] call _attach;
  152.  
  153. [false, "white", [-0.775, 1.475, -1]] call _attach;
  154. [true, "white", [0.775, 1.475, -1]] call _attach;
  155.  
  156. [true, "red", [0.525, -4.5, -1.3]] call _attach;
  157. [false, "blue", [-0.525, -4.5, -1.3]] call _attach;
  158.  
  159. [true, "red", [-0.4, -4.95, 0.155]] call _attach;
  160. [false, "blue", [0.4, -4.95, 0.155]] call _attach;
  161. };
  162.  
  163. };
  164.  
  165. _lightsOn = true;
  166. while {(alive _veh)} do
  167. {
  168. if (!(_veh getVariable "lights")) exitWith {};
  169. if (_lightsOn) then
  170. {
  171. for [{_i=0}, {_i<_flashes}, {_i=_i+1}] do
  172. {
  173. { (_x select 0) setLightBrightness _brightnessHigh; } forEach _leftLights;
  174. uiSleep _flashOn;
  175. { (_x select 0) setLightBrightness _brightnessLow; } forEach _leftLights;
  176. uiSleep _flashOff;
  177. };
  178. { (_x select 0) setLightBrightness 0; } forEach _leftLights;
  179.  
  180. for [{_i=0}, {_i<_flashes}, {_i=_i+1}] do
  181. {
  182. { (_x select 0) setLightBrightness _brightnessHigh; } forEach _rightLights;
  183. uiSleep _flashOn;
  184. { (_x select 0) setLightBrightness _brightnessLow; } forEach _rightLights;
  185. uiSleep _flashOff;
  186. };
  187. { (_x select 0) setLightBrightness 0; } forEach _rightLights;
  188. };
  189. };
  190.  
  191. { deleteVehicle (_x select 0) } foreach _leftLights;
  192. { deleteVehicle (_x select 0) } foreach _rightLights;
  193.  
  194. _leftLights = [];
  195. _rightLights = [];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement