Advertisement
Guest User

Untitled

a guest
Jul 26th, 2018
403
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.67 KB | None | 0 0
  1. #include "script_macros.hpp"
  2. /*
  3. File: functions.sqf
  4. Author: Bryan "Tonic" Boardwine
  5.  
  6. Description: They are functions.
  7. */
  8.  
  9. publicVariable "TON_fnc_terrainSort";
  10.  
  11. TON_fnc_index =
  12. compileFinal "
  13. private [""_item"",""_stack""];
  14. _item = _this select 0;
  15. _stack = _this select 1;
  16. _return = -1;
  17.  
  18. {
  19. if (_item in _x) exitWith {
  20. _return = _forEachIndex;
  21. };
  22. } forEach _stack;
  23.  
  24. _return;
  25. ";
  26.  
  27. TON_fnc_player_query =
  28. compileFinal "
  29. private [""_ret""];
  30. _ret = _this select 0;
  31. if (isNull _ret) exitWith {};
  32. if (isNil ""_ret"") exitWith {};
  33.  
  34. [life_atmbank,life_cash,owner player,player,profileNameSteam,getPlayerUID player,playerSide] remoteExecCall [""life_fnc_adminInfo"",_ret];
  35. ";
  36. publicVariable "TON_fnc_player_query";
  37. publicVariable "TON_fnc_index";
  38.  
  39. TON_fnc_isnumber =
  40. compileFinal "
  41. private [""_valid"",""_array""];
  42. _valid = [""0"",""1"",""2"",""3"",""4"",""5"",""6"",""7"",""8"",""9""];
  43. _array = [_this select 0] call KRON_StrToArray;
  44. _return = true;
  45.  
  46. {
  47. if (!(_x in _valid)) exitWith {
  48. _return = false;
  49. };
  50. } forEach _array;
  51. _return;
  52. ";
  53.  
  54. publicVariable "TON_fnc_isnumber";
  55.  
  56. TON_fnc_clientGangKick =
  57. compileFinal "
  58. private [""_unit"",""_group""];
  59. _unit = _this select 0;
  60. _group = _this select 1;
  61. if (isNil ""_unit"" || isNil ""_group"") exitWith {};
  62. if (player isEqualTo _unit && (group player) == _group) then {
  63. life_my_gang = objNull;
  64. [player] joinSilent (createGroup civilian);
  65. hint localize ""STR_GNOTF_KickOutGang"";
  66. };
  67. ";
  68.  
  69. publicVariable "TON_fnc_clientGangKick";
  70.  
  71. TON_fnc_clientGetKey =
  72. compileFinal "
  73. private [""_vehicle"",""_unit"",""_giver""];
  74. _vehicle = _this select 0;
  75. _unit = _this select 1;
  76. _giver = _this select 2;
  77. if (isNil ""_unit"" || isNil ""_giver"") exitWith {};
  78. if (player isEqualTo _unit && !(_vehicle in life_vehicles)) then {
  79. _name = getText(configFile >> ""CfgVehicles"" >> (typeOf _vehicle) >> ""displayName"");
  80. hint format [localize ""STR_NOTF_gaveKeysFrom"",_giver,_name];
  81. life_vehicles pushBack _vehicle;
  82. [getPlayerUID player,playerSide,_vehicle,1] remoteExecCall [""TON_fnc_keyManagement"",2];
  83. };
  84. ";
  85.  
  86. publicVariable "TON_fnc_clientGetKey";
  87.  
  88. TON_fnc_clientGangLeader =
  89. compileFinal "
  90. private [""_unit"",""_group""];
  91. _unit = _this select 0;
  92. _group = _this select 1;
  93. if (isNil ""_unit"" || isNil ""_group"") exitWith {};
  94. if (player isEqualTo _unit && (group player) == _group) then {
  95. player setRank ""COLONEL"";
  96. _group selectLeader _unit;
  97. hint localize ""STR_GNOTF_GaveTransfer"";
  98. };
  99. ";
  100.  
  101. publicVariable "TON_fnc_clientGangLeader";
  102.  
  103. TON_fnc_clientGangLeft =
  104. compileFinal "
  105. private [""_unit"",""_group""];
  106. _unit = _this select 0;
  107. _group = _this select 1;
  108. if (isNil ""_unit"" || isNil ""_group"") exitWith {};
  109. if (player isEqualTo _unit && (group player) == _group) then {
  110. life_my_gang = objNull;
  111. [player] joinSilent (createGroup civilian);
  112. hint localize ""STR_GNOTF_LeaveGang"";
  113. };
  114. ";
  115.  
  116. publicVariable "TON_fnc_clientGangLeft";
  117.  
  118. //Cell Phone Messaging
  119. /*
  120. -fnc_cell_textmsg
  121. -fnc_cell_textcop
  122. -fnc_cell_textadmin
  123. -fnc_cell_adminmsg
  124. -fnc_cell_adminmsgall
  125. */
  126.  
  127. //To EMS
  128. TON_fnc_cell_emsrequest =
  129. compileFinal "
  130. private [""_msg"",""_to""];
  131. ctrlShow[2404,false];
  132. _msg = ctrlText 2400;
  133. _length = count (toArray(_msg));
  134. if (_length > 400) exitWith {hint localize ""STR_CELLMSG_LIMITEXCEEDED"";ctrlShow[2404,true];};
  135. _to = ""EMS Units"";
  136. if (_msg isEqualTo """") exitWith {hint localize ""STR_CELLMSG_EnterMSG"";ctrlShow[2404,true];};
  137.  
  138. [_msg,name player,5,mapGridPosition player,player] remoteExecCall [""TON_fnc_clientMessage"",independent];
  139. [] call life_fnc_cellphone;
  140. hint format [localize ""STR_CELLMSG_ToEMS"",_to,_msg];
  141. ctrlShow[2404,true];
  142. ";
  143. //To One Person
  144. TON_fnc_cell_textmsg =
  145. compileFinal "
  146. private [""_msg"",""_to""];
  147. ctrlShow[2401,false];
  148. _msg = ctrlText 2400;
  149.  
  150. _length = count (toArray(_msg));
  151. if (_length > 400) exitWith {hint localize ""STR_CELLMSG_LIMITEXCEEDED"";ctrlShow[2401,true];};
  152. if (lbCurSel 2100 isEqualTo -1) exitWith {hint localize ""STR_CELLMSG_SelectPerson""; ctrlShow[2401,true];};
  153.  
  154. _to = call compile format [""%1"",(lbData[2100,(lbCurSel 2100)])];
  155. if (isNull _to) exitWith {ctrlShow[2401,true];};
  156. if (isNil ""_to"") exitWith {ctrlShow[2401,true];};
  157. if (_msg isEqualTo """") exitWith {hint localize ""STR_CELLMSG_EnterMSG"";ctrlShow[2401,true];};
  158.  
  159. [_msg,name player,0] remoteExecCall [""TON_fnc_clientMessage"",_to];
  160. [] call life_fnc_cellphone;
  161. hint format [localize ""STR_CELLMSG_ToPerson"",name _to,_msg];
  162. ctrlShow[2401,true];
  163. ";
  164. //To All Cops
  165. TON_fnc_cell_textcop =
  166. compileFinal "
  167. private [""_msg"",""_to""];
  168. ctrlShow[2402,false];
  169. _msg = ctrlText 2400;
  170. _to = ""The Police"";
  171.  
  172. if (_msg isEqualTo """") exitWith {hint localize ""STR_CELLMSG_EnterMSG"";ctrlShow[2402,true];};
  173. _length = count (toArray(_msg));
  174. if (_length > 400) exitWith {hint localize ""STR_CELLMSG_LIMITEXCEEDED"";ctrlShow[2402,true];};
  175.  
  176. [_msg,name player,1,mapGridPosition player,player] remoteExecCall [""TON_fnc_clientMessage"",-2];
  177. [] call life_fnc_cellphone;
  178. hint format [localize ""STR_CELLMSG_ToPerson"",_to,_msg];
  179. ctrlShow[2402,true];
  180. ";
  181. //To All Admins
  182. TON_fnc_cell_textadmin =
  183. compileFinal "
  184. private [""_msg"",""_to"",""_from""];
  185. ctrlShow[2403,false];
  186. _msg = ctrlText 2400;
  187. _to = ""The Admins"";
  188.  
  189. if (_msg isEqualTo """") exitWith {hint localize ""STR_CELLMSG_EnterMSG"";ctrlShow[2403,true];};
  190. _length = count (toArray(_msg));
  191. if (_length > 400) exitWith {hint localize ""STR_CELLMSG_LIMITEXCEEDED"";ctrlShow[2403,true];};
  192.  
  193. [_msg,name player,2,mapGridPosition player,player] remoteExecCall [""TON_fnc_clientMessage"",-2];
  194. [] call life_fnc_cellphone;
  195. hint format [localize ""STR_CELLMSG_ToPerson"",_to,_msg];
  196. ctrlShow[2403,true];
  197. ";
  198. //Admin To One Person
  199. TON_fnc_cell_adminmsg =
  200. compileFinal "
  201. if (isServer) exitWith {};
  202. if ((call life_adminlevel) < 1) exitWith {hint localize ""STR_CELLMSG_NoAdmin"";};
  203. private [""_msg"",""_to""];
  204. ctrlShow[2407,false];
  205. _msg = ctrlText 2400;
  206. _to = call compile format [""%1"",(lbData[2100,(lbCurSel 2100)])];
  207. if (isNull _to) exitWith {ctrlShow[2407,true];};
  208. if (isNil ""_to"") exitWith {ctrlShow[2407,true];};
  209. if (_msg isEqualTo """") exitWith {hint localize ""STR_CELLMSG_EnterMSG"";ctrlShow[2407,true];};
  210.  
  211. [_msg,name player,3] remoteExecCall [""TON_fnc_clientMessage"",_to];
  212. [] call life_fnc_cellphone;
  213. hint format [localize ""STR_CELLMSG_AdminToPerson"",name _to,_msg];
  214. ctrlShow[2407,true];
  215. ";
  216.  
  217. TON_fnc_cell_adminmsgall =
  218. compileFinal "
  219. if (isServer) exitWith {};
  220. if ((call life_adminlevel) < 1) exitWith {hint localize ""STR_CELLMSG_NoAdmin"";};
  221. private [""_msg"",""_from""];
  222. ctrlShow[2406,false];
  223. _msg = ctrlText 2400;
  224. if (_msg isEqualTo """") exitWith {hint localize ""STR_CELLMSG_EnterMSG"";ctrlShow[2406,true];};
  225.  
  226. [_msg,name player,4] remoteExecCall [""TON_fnc_clientMessage"",-2];
  227. [] call life_fnc_cellphone;
  228. hint format [localize ""STR_CELLMSG_AdminToAll"",_msg];
  229. ctrlShow[2406,true];
  230. ";
  231.  
  232. publicVariable "TON_fnc_cell_textmsg";
  233. publicVariable "TON_fnc_cell_textcop";
  234. publicVariable "TON_fnc_cell_textadmin";
  235. publicVariable "TON_fnc_cell_adminmsg";
  236. publicVariable "TON_fnc_cell_adminmsgall";
  237. publicVariable "TON_fnc_cell_emsrequest";
  238. //Client Message
  239. /*
  240. 0 = private message
  241. 1 = police message
  242. 2 = message to admin
  243. 3 = message from admin
  244. 4 = admin message to all
  245. */
  246. TON_fnc_clientMessage =
  247. compileFinal "
  248. if (isServer) exitWith {};
  249. private [""_msg"",""_from"", ""_type""];
  250. _msg = _this select 0;
  251. _from = _this select 1;
  252. _type = _this select 2;
  253. if (_from isEqualTo """") exitWith {};
  254. switch (_type) do {
  255. case 0 : {
  256. private [""_message""];
  257. _message = format ["">>>MESSAGE FROM %1: %2"",_from,_msg];
  258. hint parseText format [""<t color='#FFCC00'><t size='2'><t align='center'>New Message<br/><br/><t color='#33CC33'><t align='left'><t size='1'>To: <t color='#ffffff'>You<br/><t color='#33CC33'>From: <t color='#ffffff'>%1<br/><br/><t color='#33CC33'>Message:<br/><t color='#ffffff'>%2"",_from,_msg];
  259.  
  260. [""TextMessage"",[format [""You Received A New Private Message From %1"",_from]]] call bis_fnc_showNotification;
  261. systemChat _message;
  262. };
  263.  
  264. case 1 : {
  265. if (side player != west) exitWith {};
  266. private [""_message"",""_loc"",""_unit""];
  267. _loc = _this select 3;
  268. _unit = _this select 4;
  269. _message = format [""--- 911 DISPATCH FROM %1: %2"",_from,_msg];
  270. if (isNil ""_loc"") then {_loc = ""Unknown"";};
  271. hint parseText format [""<t color='#316dff'><t size='2'><t align='center'>New Dispatch<br/><br/><t color='#33CC33'><t align='left'><t size='1'>To: <t color='#ffffff'>All Officers<br/><t color='#33CC33'>From: <t color='#ffffff'>%1<br/><t color='#33CC33'>Coords: <t color='#ffffff'>%2<br/><br/><t color='#33CC33'>Message:<br/><t color='#ffffff'>%3"",_from,_loc,_msg];
  272.  
  273. [""PoliceDispatch"",[format [""A New Police Report From: %1"",_from]]] call bis_fnc_showNotification;
  274. systemChat _message;
  275. };
  276.  
  277. case 2 : {
  278. if ((call life_adminlevel) < 1) exitWith {};
  279. private [""_message"",""_loc"",""_unit""];
  280. _loc = _this select 3;
  281. _unit = _this select 4;
  282. _message = format [""!!! ADMIN REQUEST FROM %1: %2"",_from,_msg];
  283. if (isNil ""_loc"") then {_loc = ""Unknown"";};
  284. hint parseText format [""<t color='#ffcefe'><t size='2'><t align='center'>Admin Request<br/><br/><t color='#33CC33'><t align='left'><t size='1'>To: <t color='#ffffff'>Admins<br/><t color='#33CC33'>From: <t color='#ffffff'>%1<br/><t color='#33CC33'>Coords: <t color='#ffffff'>%2<br/><br/><t color='#33CC33'>Message:<br/><t color='#ffffff'>%3"",_from,_loc,_msg];
  285.  
  286. [""AdminDispatch"",[format [""%1 Has Requested An Admin!"",_from]]] call bis_fnc_showNotification;
  287. systemChat _message;
  288. };
  289.  
  290. case 3 : {
  291. private [""_message""];
  292. _message = format [""!!! ADMIN MESSAGE: %1"",_msg];
  293. _admin = format [""Sent by admin: %1"", _from];
  294. hint parseText format [""<t color='#FF0000'><t size='2'><t align='center'>Admin Message<br/><br/><t color='#33CC33'><t align='left'><t size='1'>To: <t color='#ffffff'>You<br/><t color='#33CC33'>From: <t color='#ffffff'>An Admin<br/><br/><t color='#33CC33'>Message:<br/><t color='#ffffff'>%1"",_msg];
  295.  
  296. [""AdminMessage"",[""You Have Received A Message From An Admin!""]] call bis_fnc_showNotification;
  297. systemChat _message;
  298. if ((call life_adminlevel) > 0) then {systemChat _admin;};
  299. };
  300.  
  301. case 4 : {
  302. private [""_message"",""_admin""];
  303. _message = format [""!!!ADMIN MESSAGE: %1"",_msg];
  304. _admin = format [""Sent by admin: %1"", _from];
  305. hint parseText format [""<t color='#FF0000'><t size='2'><t align='center'>Admin Message<br/><br/><t color='#33CC33'><t align='left'><t size='1'>To: <t color='#ffffff'>All Players<br/><t color='#33CC33'>From: <t color='#ffffff'>The Admins<br/><br/><t color='#33CC33'>Message:<br/><t color='#ffffff'>%1"",_msg];
  306.  
  307. [""AdminMessage"",[""You Have Received A Message From An Admin!""]] call bis_fnc_showNotification;
  308. systemChat _message;
  309. if ((call life_adminlevel) > 0) then {systemChat _admin;};
  310. };
  311.  
  312. case 5: {
  313. if (side player != independent) exitWith {};
  314. private [""_message"",""_loc"",""_unit""];
  315. _loc = _this select 3;
  316. _unit = _this select 4;
  317. _message = format [""!!! EMS REQUEST: %1"",_msg];
  318. hint parseText format [""<t color='#FFCC00'><t size='2'><t align='center'>EMS Request<br/><br/><t color='#33CC33'><t align='left'><t size='1'>To: <t color='#ffffff'>You<br/><t color='#33CC33'>From: <t color='#ffffff'>%1<br/><t color='#33CC33'>Coords: <t color='#ffffff'>%2<br/><br/><t color='#33CC33'>Message:<br/><t color='#ffffff'>%3"",_from,_loc,_msg];
  319.  
  320. [""TextMessage"",[format [""EMS Request from %1"",_from]]] call bis_fnc_showNotification;
  321. };
  322. };
  323. ";
  324. publicVariable "TON_fnc_clientMessage";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement