Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Only runs the following code if the machines executing it is the server.
- if (!isServer) exitWith {};
- if (isServer) then {
- // Add a "killed" CBA event-handler to all units in the game.
- ["CAManBase", "killed", {
- // Telling the previously mentioned event-handler which parameters we need access to.
- params ["_unit", ["_killer", objNull]];
- // Only use the following line of code if you are doing strictly PVP, this will remove PVE capabilities.
- // To enable, simply remove the /'s signifying a comment.
- // if !(isPlayer _unit) exitWith {};
- // This sets the "_killer" variable to the last unit that damaged the target unit.
- // If the killer is the target itself, then the target died due to bleeding out.
- _killer = _unit getVariable ["ace_medical_lastDamageSource", objNull];
- // Remotely executing a system chat message that will display our kill-feed statement.
- [[_unit, _killer], {
- // Grabbing our previous variables to format the kill-feed statement.
- params ["_unit", "_killer"];
- // Initializing the "killFeedStatement" variable.
- _killFeedStatement = "";
- // Checking whether the target unit was killed by another unit or bled out.
- if (_killer isEqualTo _unit) then {
- // Initializes a variable to contain the unit's name.
- _unitName = name _unit;
- // Formatting the kill-feed statement that displays when a unit has bled out.
- _killFeedStatement = format ["%1 has died of blood loss.", _unitName];
- // Displays the kill-feed statement as a system chat log.
- systemChat _killFeedStatement;
- } else {
- // Initializing variables to be used in the formatting of the kill-feed statement.
- _unitName = name _unit;
- _killerName = name _killer;
- _distance = _unit distance _killer;
- // Formatting the regular kill-feed statement.
- _killFeedStatement = format ["%1 was killed by %2. [%3m]", _unitName, _killerName, _distance];
- // Displays the kill-feed statement as a system chat log.
- systemChat _killFeedStatement;
- };
- }] remoteExec ["Call", 0];
- }] call CBA_fnc_addClassEventHandler;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement