Advertisement
READTHESCROLL

ZKilled.sqf

Oct 10th, 2015
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 2.89 KB | None | 0 0
  1. /*
  2. ////////////////////////////////////////////////////
  3. ZKilled.sqf - WIP
  4. WIP Credits to eraser1 and IT07
  5. for their respective onKilled.sqf's (DMS & VEMF)
  6. ////////////////////////////////////////////////////
  7. */
  8.  
  9. private ["_unit","_killer","_playerObj","_veh","_respect","_repGain","_killMsg","_dist","_bonus","_roadKilled"/*,"_message"*/];
  10.  
  11. _unit               = _this select 0;
  12. _killer             = _this select 1;
  13. _playerObj      = objNull;
  14. _roadKilled     = false;
  15.  
  16. if (isPlayer _killer) then
  17. {
  18.     _veh = vehicle _killer;
  19.     _playerObj = _killer;
  20.     // Fix for players killing AI from mounted vehicle guns
  21.     if (!(_killer isKindOf "Exile_Unit_Player") && {!isNull (gunner _killer)}) then
  22.     {
  23.         _playerObj = gunner _killer;
  24.     };
  25.  
  26.     if (!(_veh isEqualTo _killer) && {(driver _veh) isEqualTo _killer}) then
  27.     {
  28.         _playerObj = driver _veh;
  29.         _roadKilled = true;
  30.     };
  31. };
  32.  
  33. if ((!isNull _playerObj) && {((getPlayerUID _playerObj) != "") && {_playerObj isKindOf "Exile_Unit_Player"}}) then
  34. {
  35.     _repGain = 10;
  36.  
  37.     if (_roadKilled) then
  38.     {
  39.         //_killMsg = ["ROADKILL?! -20 REP! DONT BE A PUSSY!","ROADKILL!? -20 REP FOR BEING LAME!","ERMAHGERD ROADKILL! -20 REP!"] call BIS_fnc_selectRandom;
  40.         _repGain = -20;
  41.         _bonus = 0;
  42.     };
  43.     _respect = _playerObj getVariable ["ExileScore", 0];
  44.     //_message = [[]];
  45.     _killMsg = ["ZOMBIE WACKED","ZOMBIE CLIPPED","ZOMBIE DISABLED","ZOMBIE DISQUALIFIED","ZOMBIE WIPED","ZOMBIE WIPED","ZOMBIE ERASED","ZOMBIE LYNCHED","ZOMBIE WRECKED","ZOMBIE NEUTRALIZED","ZOMBIE SNUFFED","ZOMBIE WASTED","ZOMBIE ZAPPED"] call BIS_fnc_selectRandom;
  46.     _killMsgPssy = ["ROADKILL?! -20 REP! DONT BE A PUSSY!","ROADKILL!? -20 REP FOR BEING LAME!","ERMAHGERD ROADKILL! -20 REP!"] call BIS_fnc_selectRandom;
  47.     //(_message select 0) pushBack [_killMsg, _repGain + _bonus];
  48.     _dist = _unit distance _playerObj;
  49.     /*switch true do
  50.     {
  51.         case (_roadKilled):
  52.         {
  53.             (_message select 0) pushBack ["ROADKILL?! -20 REP! DONT BE A PUSSY!",-20 + 0] // OR vvvv
  54.             _killMsg = ["ROADKILL?! -20 REP! DONT BE A PUSSY!","ROADKILL!? -20 REP FOR BEING LAME!","ERMAHGERD ROADKEEL! -20 REP!"] call BIS_fnc_selectRandom;
  55.             _repGain = -21;
  56.             _bonus = 0;
  57.         };
  58.     };*/
  59.     _bonus = round (_dist / 4);
  60.     // Set client's respect
  61.     _respect = _respect + _repGain + _bonus;
  62.     _playerObj setVariable ["ExileScore", _respect];
  63.     // Send frag message
  64. if (_roadKilled) then
  65.     {
  66.         [_playerObj, "showFragRequest", [[[_killMsgPssy, _repGain + _bonus]]]] call ExileServer_system_network_send_to;
  67.     }
  68.     else
  69.     {
  70.         [_playerObj, "showFragRequest", [[[_killMsg, _repGain + _bonus]]]] call ExileServer_system_network_send_to;
  71.     };
  72.     ExileClientPlayerScore = _respect;
  73.     (owner _playerObj) publicVariableClient "ExileClientPlayerScore";
  74.     ExileClientPlayerScore = nil;
  75.     // Update client database entry
  76.     format["setAccountMoneyAndRespect:%1:%2:%3", _playerObj getVariable ["ExileMoney", 0], _respect, (getPlayerUID _playerObj)] call ExileServer_system_database_query_fireAndForget;
  77. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement