Advertisement
Guest User

functions.sqf

a guest
Nov 28th, 2014
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 11.61 KB | None | 0 0
  1. life_fnc_sidechat =
  2. compileFinal "
  3.     if(life_sidechat) then {life_sidechat = false;} else {life_sidechat = true;};
  4.     [[player,life_sidechat,playerSide],""TON_fnc_managesc"",false,false] spawn life_fnc_MP;
  5.     [] call life_fnc_settingsMenu;
  6. ";
  7.  
  8. publicVariable "life_fnc_sidechat";
  9.  
  10. TON_fnc_index =
  11. compileFinal "
  12.     private[""_item"",""_stack""];
  13.     _item = _this select 0;
  14.     _stack = _this select 1;
  15.     _return = -1;
  16.  
  17.     {
  18.         if(_item in _x) exitWith {
  19.             _return = _forEachIndex;
  20.         };
  21.     } foreach _stack;
  22.  
  23.     _return;
  24. ";
  25.  
  26. TON_fnc_player_query =
  27. compileFinal "
  28.     private[""_ret""];
  29.     _ret = _this select 0;
  30.     if(isNull _ret) exitWith {};
  31.     if(isNil ""_ret"") exitWith {};
  32.    
  33.     [[life_atmcash,life_cash,owner player,player],""life_fnc_admininfo"",_ret,false] spawn life_fnc_MP;
  34. ";
  35. publicVariable "TON_fnc_player_query";
  36.  
  37. publicVariable "TON_fnc_index";
  38.  
  39. TON_fnc_clientWireTransfer =
  40. compileFinal "
  41.     private[""_unit"",""_val"",""_from""];
  42.     _val = _this select 0;
  43.     _from = _this select 1;
  44.     if(!([str(_val)] call TON_fnc_isnumber)) exitWith {};
  45.     if(_from == """") exitWith {};
  46.     life_atmcash = life_atmcash + _val;
  47.     hint format[""%1 has wire transferred $%2 to you."",_from,[_val] call life_fnc_numberText];
  48.    
  49. ";
  50. publicVariable "TON_fnc_clientWireTransfer";
  51.  
  52. TON_fnc_isnumber =
  53. compileFinal "
  54.     private[""_valid"",""_value"",""_compare""];
  55.     _value = _this select 0;
  56.     _valid = [""0"",""1"",""2"",""3"",""4"",""5"",""6"",""7"",""8"",""9""];
  57.     _array = [_value] call KRON_StrToArray;
  58.     _return = true;
  59.    
  60.     {
  61.         if(_x in _valid) then  
  62.         {}
  63.         else
  64.         {
  65.             _return = false;
  66.         };
  67.     } foreach _array;
  68.     _return;
  69. ";
  70.  
  71. publicVariable "TON_fnc_isnumber";
  72.  
  73. TON_fnc_clientGangKick =
  74. compileFinal "
  75.     private[""_unit"",""_group""];
  76.     _unit = _this select 0;
  77.     _group = _this select 1;
  78.     if(isNil ""_unit"" OR isNil ""_group"") exitWith {};
  79.     if(player == _unit && (group player) == _group) then
  80.     {
  81.         life_my_gang = ObjNull;
  82.         [player] joinSilent (createGroup civilian);
  83.         hint ""You have been kicked out of the gang."";
  84.        
  85.     };
  86. ";
  87. publicVariable "TON_fnc_clientGangKick";
  88.  
  89. TON_fnc_clientGetKey =
  90. compileFinal "
  91.     private[""_vehicle"",""_unit"",""_giver""];
  92.     _vehicle = _this select 0;
  93.     _unit = _this select 1;
  94.     _giver = _this select 2;
  95.     if(isNil ""_unit"" OR isNil ""_giver"") exitWith {};
  96.     if(player == _unit && !(_vehicle in life_vehicles)) then
  97.     {
  98.         _name = getText(configFile >> ""CfgVehicles"" >> (typeOf _vehicle) >> ""displayName"");
  99.         hint format[""%1 has gave you keys for a %2"",_giver,_name];
  100.         life_vehicles set[count life_vehicles, _vehicle];
  101.     };
  102. ";
  103.  
  104. publicVariable "TON_fnc_clientGetKey";
  105.  
  106. TON_fnc_clientGangLeader =
  107. compileFinal "
  108.     private[""_unit"",""_group""];
  109.     _unit = _this select 0;
  110.     _group = _this select 1;
  111.     if(isNil ""_unit"" OR isNil ""_group"") exitWith {};
  112.     if(player == _unit && (group player) == _group) then
  113.     {
  114.         player setRank ""COLONEL"";
  115.         _group selectLeader _unit;
  116.         hint ""You have been made the new leader."";
  117.     };
  118. ";
  119.  
  120. publicVariable "TON_fnc_clientGangLeader";
  121.  
  122. //Cell Phone Messaging
  123. /*
  124.     -fnc_cell_textmsg
  125.     -fnc_cell_textcop
  126.     -fnc_cell_textadmin
  127.     -fnc_cell_adminmsg
  128.     -fnc_cell_adminmsgall
  129. */
  130.  
  131. //To EMS
  132. TON_fnc_cell_emsrequest =
  133. compileFinal "
  134. private[""_msg"",""_to""];
  135.     ctrlShow[3022,false];
  136.     _msg = ctrlText 3003;
  137.     _to = ""EMS Units"";
  138.     if(_msg == """") exitWith {hint ""You must enter a message to send!"";ctrlShow[3022,true];};
  139.        
  140.     [[_msg,name player,5],""TON_fnc_clientMessage"",independent,false] spawn life_fnc_MP;
  141.     [] call life_fnc_cellphone;
  142.     hint format[""You have sent a message to all EMS Units."",_to,_msg];
  143.     ctrlShow[3022,true];
  144. ";
  145. //To One Person
  146. TON_fnc_cell_textmsg =
  147. compileFinal "
  148.     private[""_msg"",""_to""];
  149.     ctrlShow[3015,false];
  150.     _msg = ctrlText 3003;
  151.     if(lbCurSel 3004 == -1) exitWith {hint ""You must select a player you are sending the text to!""; ctrlShow[3015,true];};
  152.     _to = call compile format[""%1"",(lbData[3004,(lbCurSel 3004)])];
  153.     if(isNull _to) exitWith {ctrlShow[3015,true];};
  154.     if(isNil ""_to"") exitWith {ctrlShow[3015,true];};
  155.     if(_msg == """") exitWith {hint ""You must enter a message to send!"";ctrlShow[3015,true];};
  156.    
  157.     [[_msg,name player,0],""TON_fnc_clientMessage"",_to,false] spawn life_fnc_MP;
  158.     [] call life_fnc_cellphone;
  159.     hint format[""You sent %1 a message: %2"",name _to,_msg];
  160.     ctrlShow[3015,true];
  161. ";
  162. //To All Cops
  163. TON_fnc_cell_textcop =
  164. compileFinal "
  165.     private[""_msg"",""_to""];
  166.     ctrlShow[3016,false];
  167.     _msg = ctrlText 3003;
  168.     _to = ""The Police"";
  169.     if(_msg == """") exitWith {hint ""You must enter a message to send!"";ctrlShow[3016,true];};
  170.        
  171.     [[_msg,name player,1],""TON_fnc_clientMessage"",true,false] spawn life_fnc_MP;
  172.     [] call life_fnc_cellphone;
  173.     hint format[""You sent %1 a message: %2"",_to,_msg];
  174.     ctrlShow[3016,true];
  175. ";
  176. //To All Admins
  177. TON_fnc_cell_textadmin =
  178. compileFinal "
  179.     private[""_msg"",""_to"",""_from""];
  180.     ctrlShow[3017,false];
  181.     _msg = ctrlText 3003;
  182.     _to = ""The Admins"";
  183.     if(_msg == """") exitWith {hint ""You must enter a message to send!"";ctrlShow[3017,true];};
  184.        
  185.     [[_msg,name player,2],""TON_fnc_clientMessage"",true,false] spawn life_fnc_MP;
  186.     [] call life_fnc_cellphone;
  187.     hint format[""You sent %1 a message: %2"",_to,_msg];
  188.     ctrlShow[3017,true];
  189. ";
  190. //Admin To One Person
  191. TON_fnc_cell_adminmsg =
  192. compileFinal "
  193.     if(isServer) exitWith {};
  194.     if((call life_adminlevel) < 1) exitWith {hint ""You are not an admin!"";};
  195.     private[""_msg"",""_to""];
  196.     _msg = ctrlText 3003;
  197.     _to = call compile format[""%1"",(lbData[3004,(lbCurSel 3004)])];
  198.     if(isNull _to) exitWith {};
  199.     if(_msg == """") exitWith {hint ""You must enter a message to send!"";};
  200.    
  201.     [[_msg,name player,3],""TON_fnc_clientMessage"",_to,false] spawn life_fnc_MP;
  202.     [] call life_fnc_cellphone;
  203.     hint format[""Admin Message Sent To: %1 - Message: %2"",name _to,_msg];
  204. ";
  205.  
  206. TON_fnc_cell_adminmsgall =
  207. compileFinal "
  208.     if(isServer) exitWith {};
  209.     if((call life_adminlevel) < 1) exitWith {hint ""You are not an admin!"";};
  210.     private[""_msg"",""_from""];
  211.     _msg = ctrlText 3003;
  212.     if(_msg == """") exitWith {hint ""You must enter a message to send!"";};
  213.    
  214.     [[_msg,name player,4],""TON_fnc_clientMessage"",true,false] spawn life_fnc_MP;
  215.     [] call life_fnc_cellphone;
  216.     hint format[""Admin Message Sent To All: %1"",_msg];
  217. ";
  218.  
  219. //CopMSG
  220. TON_fnc_cell_copmsgall =
  221. compileFinal "
  222. if(isServer) exitWith {};
  223.    if((call life_coplevel) < 1) exitWith {hint ""Du bist kein Polizist!"";};
  224.    private[""_msg"",""_from""];
  225.    _msg = ctrlText 3003;
  226.    if(_msg == """") exitWith {hint ""Du musst etwas eingeben!"";};
  227.    [[_msg,name player,6],""clientMessage"",true,false] spawn life_fnc_MP;
  228.    [] call life_fnc_cellphone;
  229.    hint format[""Polizeimeldung gesendet: %1"",_msg];
  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. publicVariable "TON_fnc_cell_copmsgall";
  239. //Client Message
  240. /*
  241.     0 = private message
  242.     1 = police message
  243.     2 = message to admin
  244.     3 = message from admin
  245.     4 = admin message to all
  246. */
  247. TON_fnc_clientMessage =
  248. compileFinal "
  249.     if(isServer) exitWith {};
  250.     private[""_msg"",""_from"", ""_type""];
  251.     _msg = _this select 0;
  252.     _from = _this select 1;
  253.     _type = _this select 2;
  254.     if(_from == """") exitWith {};
  255.     switch (_type) do
  256.     {
  257.         case 0 :
  258.         {
  259.             private[""_message""];
  260.             _message = format["">>>MESSAGE FROM %1: %2"",_from,_msg];
  261.             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];
  262.            
  263.             [""TextMessage"",[format[""You Received A New Private Message From %1"",_from]]] call bis_fnc_showNotification;
  264.             systemChat _message;
  265.         };
  266.        
  267.         case 1 :
  268.         {
  269.             if(side player != west) exitWith {};
  270.             private[""_message""];
  271.             _message = format[""---911 DISPATCH FROM %1: %2"",_from,_msg];
  272.             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/><br/><t color='#33CC33'>Message:<br/><t color='#ffffff'>%2"",_from,_msg];
  273.            
  274.             [""PoliceDispatch"",[format[""A New Police Report From: %1"",_from]]] call bis_fnc_showNotification;
  275.             systemChat _message;
  276.         };
  277.        
  278.         case 2 :
  279.         {
  280.             if((call life_adminlevel) < 1) exitWith {};
  281.             private[""_message""];
  282.             _message = format[""???ADMIN REQUEST FROM %1: %2"",_from,_msg];
  283.             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/><br/><t color='#33CC33'>Message:<br/><t color='#ffffff'>%2"",_from,_msg];
  284.            
  285.             [""AdminDispatch"",[format[""%1 Has Requested An Admin!"",_from]]] call bis_fnc_showNotification;
  286.             systemChat _message;
  287.         };
  288.        
  289.         case 3 :
  290.         {
  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.         {
  303.             private[""_message"",""_admin""];
  304.             _message = format[""!!!ADMIN MESSAGE: %1"",_msg];
  305.             _admin = format[""Sent by admin: %1"", _from];
  306.             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];
  307.            
  308.             [""AdminMessage"",[""You Have Received A Message From An Admin!""]] call bis_fnc_showNotification;
  309.             systemChat _message;
  310.             if((call life_adminlevel) > 0) then {systemChat _admin;};
  311.         };
  312.        
  313.         case 5: {
  314.             private[""_message""];
  315.             _message = format[""!!!EMS REQUEST: %1"",_msg];
  316.             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/><br/><t color='#33CC33'>Message:<br/><t color='#ffffff'>%2"",_from,_msg];
  317.            
  318.             [""TextMessage"",[format[""EMS Request from %1"",_from]]] call bis_fnc_showNotification;
  319.         };
  320.                
  321.                case 6:
  322.        {
  323.            private[""_message"",""_admin""];
  324.             _message = format[""!!!POLIZEIMELDUNG: %1"",_msg];
  325.             _admin = format[""Sent by admin: %1"", _from];
  326.             hint parseText format [""<t color='#FF0000'><t size='2'><t align='center'>Polizei Meldung<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 Cops<br/><br/><t color='#33CC33'>Message:<br/><t color='#ffffff'>%1"",_msg];
  327.            
  328.             [""AdminMessage"",[""You Have Received A Message From the Police!""]] call bis_fnc_showNotification;
  329.             systemChat _message;
  330.             if((call life_adminlevel) > 0) then {systemChat _admin;};
  331.        };
  332.        
  333.     };
  334. ";
  335. publicVariable "TON_fnc_clientMessage";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement