TheGamingChief

Untitled

Apr 29th, 2016
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.63 KB | None | 0 0
  1. /*///////////////////////
  2. Functions For Anything
  3. Made For RL/OL By: Speedy
  4. *////////////////////////
  5. DDOPP_taser_handleHit = {
  6. private ["_shooter","_selection","_damage","_shooter","_bullet","_ammoArr"];
  7. _victim = _this select 0;
  8. _selection = _this select 1;
  9. _damage = _this select 2;
  10. _shooter = _this select 3;
  11. _bullet = _this select 4;
  12. _ammoArr = ["B_12Gauge_74Slug","B_9x18_SD"];
  13. if (_bullet in _ammoArr) then {
  14. ["hit", _shooter, _selection, _damage] execVM "stun.sqf";
  15. };
  16.  
  17. _damage
  18. };
  19. open_safeCodeEnter =
  20. {
  21. if (dialog) exitWith { closeDialog 0; };
  22. _ok = createDialog "BankCodeEnterDLG";
  23. if ( !_ok ) then { player groupChat "Unable to open the safe code dialog!";};
  24. };
  25. gamerz_hint =
  26. {
  27. _text = _this select 0;
  28. _colour = _this select 1;
  29. _Stxt = parseText format
  30. ["
  31. <t color='%2'>%1</t><br/>
  32. ", _text, _colour];
  33. hintSilent _Stxt;
  34. };
  35. Speedy_Police_RestrainUnit = {
  36. private["_cuff","_man","_name"];
  37.  
  38. _cuff = _this select 0;
  39. _man = cursorTarget;
  40. if (player distance _man > 3) exitWith {};
  41. _name = name _man;
  42.  
  43. if (_cuff) then
  44. {
  45. if (!(_man isKindOf "Man")) exitWith {hintSilent parseText format ["<t size='1.25' font='Zeppelin33' color='#D80C0C'>Nobody To Handcuff!</t>"];};
  46. if (_man getVariable "Cuffed") exitWith {hintSilent parseText format ["<t size='1.25' font='Zeppelin33' color='#D80C0C'>Nobody To Handcuff!</t>"];};
  47. [_man,"restrain"] call fn_netSay3D;
  48. hintSilent parseText format ["<t size='1.25' font='Zeppelin33' color='#D80C0C'>%1 Cuffed</t>", _man];
  49. [nil,_man,rSwitchMove,"actspercmstpsnonwrfldnon_interrogate02_forgoten"] call RE;
  50. _man setVariable ["Cuffed",true,true];
  51. format['server globalChat "%2 was handcuffed by %1";',name player, name _man] call broadcast;
  52. } else {
  53. if (!(_man isKindOf "Man")) exitWith {hintSilent parseText format ["<t size='1.25' font='Zeppelin33' color='#D80C0C'>Nobody To Unhandcuff!</t>"];};
  54. if (!(_man getVariable "Cuffed")) exitWith {hintSilent parseText format ["<t size='1.25' font='Zeppelin33' color='#D80C0C'>Nobody To Unhandcuff!</t>"];};
  55. [_man,"restrain"] call fn_netSay3D;
  56. hintSilent parseText format ["<t size='1.25' font='Zeppelin33' color='#D80C0C'>%1 Released</t>", _man];
  57. [nil,_man,rSwitchMove,"Normal"] call RE;
  58. _man setVariable ["Cuffed",false,true];
  59. format['if(player == %1) then {isstunned = false}', _man] call broadcast;
  60. format['server globalChat "%2 was released by %1";',name player, name _man] call broadcast;
  61. };
  62. };
  63.  
  64. RL_LoadingSetText =
  65. {
  66. private ["_idc","_str","_percent"];
  67. _idc = _this select 0;
  68. _str = _this select 1;
  69. _percent = _this select 2;
  70. ((uiNamespace getVariable "RL_Dialog_loading") displayCtrl _idc) ctrlSetText _str;
  71. ((uiNamespace getVariable "RL_Dialog_loading") displayCtrl 1111) ctrlSetText format["ol_textures\misc\progressbar\progressbar%1.paa",_percent];
  72. ((uiNamespace getVariable "RL_Dialog_loading") displayCtrl 1113) ctrlSetText format["%1%2",_percent,"%"];
  73. };
  74. RL_CallESU =
  75. {
  76. private ["_unit","_location","_timeout","_ReSpawnTime","_RL_TrackMarker"];
  77. _unit = _this select 0;
  78. _unitname = name _unit;
  79. _location = _this select 1;
  80. _notDead = _unit getVariable "KOED";
  81. _gridPos = mapGridPosition getpos _unit;
  82. if(playerSide == Resistance)then
  83. {
  84. player sideChat format["(911)EMT call for %1 he was just killed at: %2",(_unitname),_gridPos];
  85. hint "Someone Has Died";
  86. _timeout = time + 200;
  87. _RL_TrackMarker = createMarker [("RL_DeadTracker_" + _unitname), getPos _unit];
  88. _RL_TrackMarker setMarkerShape "ICON";
  89. _RL_TrackMarker setMarkerColor "ColorRed";
  90. _RL_TrackMarker setMarkerType "warning";
  91. _RL_TrackMarker setMarkerSize [0.6,0.6];
  92. _RL_TrackMarker setMarkerDir getDir _unit;
  93. _RL_TrackMarker setMarkerText format [STR_DEADGUY, name player];
  94. _ReSpawnTime = 600;
  95. _timeout = time + _ReSpawnTime;
  96. sleep 3;
  97. waitUntil {(!(_unit getVariable "KOED"))};
  98. deleteMarker ("RL_DeadTracker_" + _unitname);
  99.  
  100. };
  101. };
  102. RL_CallPolice =
  103. {
  104. private ["_unit","_location","_timeout","_ReSpawnTime","_RL_TrackMarker"];
  105. _unit = _this select 0;
  106. _unitname = name _unit;
  107. _location = _this select 1;
  108. _notDead = _unit getVariable "KOED";
  109. _gridPos = mapGridPosition getpos _unit;
  110. if(playerSide == WEST)then
  111. {
  112. player sideChat format["(911)Police call for %1 he was just killed at: %2",(_unitname),_gridPos];
  113. hint "Someone Has Died";
  114. _timeout = time + 200;
  115. _RL_TrackMarker = createMarker [("RL_DeadTracker_" + _unitname), getPos _unit];
  116. _RL_TrackMarker setMarkerShape "ICON";
  117. _RL_TrackMarker setMarkerColor "ColorRed";
  118. _RL_TrackMarker setMarkerType "warning";
  119. _RL_TrackMarker setMarkerSize [0.6,0.6];
  120. _RL_TrackMarker setMarkerDir getDir _unit;
  121. _RL_TrackMarker setMarkerText format [STR_DEADGUY, _unitname];
  122. _ReSpawnTime = 600;
  123. _timeout = time + _ReSpawnTime;
  124. sleep 3;
  125. waitUntil {(!(_unit getVariable "KOED"))};
  126. deleteMarker ("RL_DeadTracker_" + _unitname);
  127. };
  128. };
  129.  
  130. RL_Msg_fnc_SrvMsg =
  131. {
  132. private["_msg"];
  133. _msg = _this select 0;
  134. RL_PV_SrvMsg = _msg;
  135. publicVariable "RL_PV_SrvMsg";
  136. if (!isNil "_msg") then
  137. {
  138. //UltRP_ServerMsg_Logic globalChat _msg;
  139. for "_i" from 0 to (count playableUnits) do
  140. {
  141. _iUnit = playableUnits select _i;
  142. if (side _iUnit == WEST || side _iUnit == EAST || side _iUnit == CIVILIAN) then
  143. {
  144. format ['server globalchat "%1";',_msg] call broadcast;
  145. //call compile format ['[%2,%2,"loc",rGlobalChat,"%1"] call RE;', _msg, _iUnit];
  146. };
  147. };
  148. };
  149. };
  150. RL_Admin_fnc_GblMsg =
  151. {
  152. private["_msg","_str"];
  153. _msg = ctrlText 5090;
  154. _str = format["(ADMIN) %1", _msg];
  155. format ['server globalchat "%1";',_str] call broadcast;
  156. //[_str] call RL_Msg_fnc_SrvMsg;
  157. };
  158. RL_Dev_fnc_GblMsg =
  159. {
  160. private["_msg","_str"];
  161. _msg = ctrlText 5090;
  162. _str = format["(DEV) %1", _msg];
  163. format ['server globalchat "%1";',_str] call broadcast;
  164. //[_str] call RL_Msg_fnc_SrvMsg;
  165. };
  166. RL_Msg_fnc_911 =
  167. {
  168. private["_msg","_sender","_iUnit"];
  169. _msg = ctrlText 1028;
  170. if (_msg == "Message") exitWith {};
  171. _sender = name player;
  172. _unit = _this select 0;
  173. _gridPos = mapGridPosition getpos _unit;
  174. closeDialog 0;
  175. hintSilent parseText format["<t font='Zeppelin33' color='#00FF44'>911 Message Sent</t>"];
  176. for "_i" from 0 to (count playableUnits) do
  177. {
  178. _iUnit = playableUnits select _i;
  179. if (side _iUnit == WEST || side _iUnit == EAST) then
  180. {
  181. call compile format ['[%3,%3,"loc",rGlobalChat,"%1(911) %2: Traced To: %4"] call RE;', _sender, _msg, _iUnit, _gridPos];
  182. };
  183. };
  184. };
  185.  
  186. RL_Msg_fnc_311 =
  187. {
  188. private["_msg","_sender","_iUnit"];
  189. _msg = ctrlText 1028;
  190. if (_msg == "Message") exitWith {};
  191. _sender = name player;
  192. closeDialog 0;
  193. hintSilent parseText format["<t font='Zeppelin33' color='#00FF44'>311 Message Sent</t>"];
  194. for "_i" from 0 to (count playableUnits) do
  195. {
  196. _iUnit = playableUnits select _i;
  197. if (side _iUnit == WEST || side _iUnit == EAST || side _iUnit == CIVILIAN) then
  198. {
  199. call compile format ['[%3,%3,"loc",rGlobalChat,"%1(311) %2"] call RE;', _sender, _msg, _iUnit];
  200. };
  201. };
  202. };
  203. RL_Msg_fnc_141 =
  204. {
  205. private["_msg","_sender","_iUnit"];
  206. _msg = ctrlText 1028;
  207. if (_msg == "Message") exitWith {};
  208. _sender = name player;
  209. closeDialog 0;
  210. hintSilent parseText format["<t font='Zeppelin33' color='#00FF44'>141 Message Sent</t>"];
  211. for "_i" from 0 to (count playableUnits) do
  212. {
  213. _iUnit = playableUnits select _i;
  214. if (side _iUnit == WEST || side _iUnit == EAST) then
  215. {
  216. call compile format ['[%2,%2,"loc",rGlobalChat,"(141) %1"] call RE;', _msg, _iUnit];
  217. };
  218. };
  219. };
  220.  
  221. format_integer = {
  222. private["_value", "_nan", "_separator"];
  223. _nan = "NotANumber";
  224. _value = _this select 0;
  225. _separator = _this select 1;
  226.  
  227. if (isNil "_value") exitWith {_nan};
  228. if (typeName _value != "SCALAR") exitWith {_nan};
  229.  
  230. if (_value == 0) exitWith {"0"};
  231.  
  232. private["_string_value", "_digits", "_remainder", "_sign"];
  233. _string_value = "";
  234. _digits = 0;
  235. _sign = if (_value < 0) then {"-"} else {""};
  236. _value = abs(round(_value));
  237. while { _value >= 1 } do {
  238. _digits = _digits + 1;
  239. if ( _digits > 1 && ((_digits - 1) % 3) == 0) then {
  240. _string_value = _separator + _string_value;
  241. };
  242. _remainder = _value % 10;
  243. _string_value = str(_remainder) + _string_value;
  244. _value = floor(_value / 10);
  245. };
  246.  
  247. _sign+_string_value
  248. };
  249. RLRPG_FormatMoney = {
  250. private["_amount", "_result"];
  251. _amount = _this select 0;
  252.  
  253. _result = format['$%1', ([_amount, ","] call format_integer)];
  254.  
  255. _result
  256. };
  257. RLRPG_FormatAmount = {
  258. private["_amount", "_result"];
  259. _amount = _this select 0;
  260.  
  261. _result = format['%1', ([_amount, ","] call format_integer)];
  262.  
  263. _result
  264. };
  265. player_get_inventory_money = {
  266. private["_invmoney"];
  267. _invmoney = 'geld' call INV_GetItemAmount;
  268. _invmoney
  269. };
  270. RLRPG_fnc_StringUCase = {
  271. private["_text", "_chararr", "_i", "_curchar", "_result"];
  272. _text = _this select 0;
  273. _result = "";
  274.  
  275. if (_text == "") exitWith {_result};
  276.  
  277. _chararr = toArray _text;
  278.  
  279. for [{_i=0}, {_i < (count _chararr)}, {_i=_i+1}] do {
  280. _curchar = _chararr select _i;
  281.  
  282. // 97 = a, 122 = z
  283. if (_curchar >= 97 && _curchar <= 122) then {
  284. _chararr set [_i, (_curchar + 65 - 97)];
  285. };
  286. };
  287.  
  288. _result = toString _chararr;
  289.  
  290. _result
  291. };
  292. RLRPG_Cfg_Inv_InDMZ = {
  293. private ["_size","_ret","_player"];
  294. _ret = [];
  295. _DMZ = ["test"];
  296. _player = _this;
  297. {
  298. _size = getMarkerSize _x;
  299. if (_player distance (getMarkerPos _x) <= (round((_size select 0) + (_size select 1)) / 2)) then {
  300. _ret set[count(_ret), _x];
  301. };
  302. } forEach _DMZ;
  303. _ret;
  304. };
  305. RLRPG_Cfg_Inv_HandleDamage = {
  306. private ["_ret","_in"];
  307. _ret = _this select 2;
  308. _shooter = _this select 3;
  309. _ammo = _this select 4;
  310. _stun = ["B_12Gauge_74Slug","B_9x18_SD"];
  311. if (_ammo in _stun) exitWith
  312. {
  313. (_this select 0) setDamage 0;
  314. ["hit", _shooter] execVM "stun.sqf";
  315. };
  316. _in = player call RLRPG_Cfg_Inv_InDMZ;
  317. if (count(_in) >= 1) then {
  318. _ret = false;
  319. };
  320. _ret;
  321. };
  322. CP_fncSearchImpoundArr = {
  323. _outArray = [];
  324.  
  325. {
  326. if ((_x select 0) == (_this select 0)) then {
  327. _outArray = _outArray + [_x select 1];
  328. };
  329. } foreach (_this select 1);
  330.  
  331. _outArray;
  332. };
  333. CP_fncRemoveImpoundArr = {
  334. _outArray = [];
  335. _found = false;
  336.  
  337. {
  338. if (not(_found)) then {
  339. if (((_x select 0) == (_this select 0)) and ((_x select 1) == (_this select 1))) then {
  340. _found = true; //Should trigger once (skip item)
  341. } else {
  342. _outArray = _outArray + [_x];
  343. };
  344. } else {
  345. _outArray = _outArray + [_x];
  346. };
  347. } foreach (_this select 2);
  348.  
  349. _outArray;
  350. };
  351.  
  352. fn_RMLogToServer = compile '
  353. _name = _this select 0;
  354. _message = _this select 1;
  355. pv_RMLog = [_name, _message];
  356. publicVariableServer "pv_RMLog";
  357. ';
Advertisement
Add Comment
Please, Sign In to add comment