SHARE
TWEET

A3 KillFeed Script

a guest Sep 17th, 2019 93 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Only runs the following code if the machines executing it is the server.
  2. if (!isServer) exitWith {};
  3. if (isServer) then {
  4.   // Add a "killed" CBA event-handler to all units in the game.
  5.   ["CAManBase", "killed", {
  6.     // Telling the previously mentioned event-handler which parameters we need access to.
  7.     params ["_unit", ["_killer", objNull]];
  8.  
  9.     // Only use the following line of code if you are doing strictly PVP, this will remove PVE capabilities.
  10.     // To enable, simply remove the /'s signifying a comment.
  11.     // if !(isPlayer _unit) exitWith {};
  12.  
  13.     // This sets the "_killer" variable to the last unit that damaged the target unit.
  14.     // If the killer is the target itself, then the target died due to bleeding out.
  15.     _killer = _unit getVariable ["ace_medical_lastDamageSource", objNull];
  16.  
  17.     // Remotely executing a system chat message that will display our kill-feed statement.
  18.     [[_unit, _killer], {
  19.       // Grabbing our previous variables to format the kill-feed statement.
  20.       params ["_unit", "_killer"];
  21.  
  22.       // Initializing the "killFeedStatement" variable.
  23.       _killFeedStatement = "";
  24.  
  25.       // Checking whether the target unit was killed by another unit or bled out.
  26.       if (_killer isEqualTo _unit) then {
  27.         // Initializes a variable to contain the unit's name.
  28.         _unitName = name _unit;
  29.  
  30.         // Formatting the kill-feed statement that displays when a unit has bled out.
  31.         _killFeedStatement = format ["%1 has died of blood loss.", _unitName];
  32.  
  33.         // Displays the kill-feed statement as a system chat log.
  34.         systemChat _killFeedStatement;
  35.       } else {
  36.         // Initializing variables to be used in the formatting of the kill-feed statement.
  37.         _unitName = name _unit;
  38.         _killerName = name _killer;
  39.         _distance = _unit distance _killer;
  40.  
  41.         // Formatting the regular kill-feed statement.
  42.         _killFeedStatement = format ["%1 was killed by %2. [%3m]", _unitName, _killerName, _distance];
  43.  
  44.         // Displays the kill-feed statement as a system chat log.
  45.         systemChat _killFeedStatement;
  46.       };
  47.     }] remoteExec ["Call", 0];
  48.   }] call CBA_fnc_addClassEventHandler;
  49. };
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top