kill messages help.

zuggles

New Member
I could use some help on refining the kill messages script in my server_playerDied.sqf

Currently, the messages will report with a brown hint box in the top right if a survivor kills a bandit/survivor. But, if a bandit kills someone it does not report. I changed rSpawn to rHint because it wasn't reporting at all the other way.

1. How do I push the message to globalChat (the commented code's were not working)
2. How do I get it to detect bandits / heros (the RPT file does not list deaths of those two classes, it does with survivors)

Code:
private["_characterID","_minutes","_newObject","_playerID","_key","_playerName","_playerID","_myGroup","_group","_victim", "_killer", "_weapon", "_message", "_distance","_loc_message","_victimName","_killerName"];
//private ["_characterID","_minutes","_newObject","_playerID","_key"];
//[unit, weapon, muzzle, mode, ammo, magazine, projectile]
_characterID =    _this select 0;
_minutes =    _this select 1;
_newObject =    _this select 2;
_playerID =    _this select 3;
_playerName =    _this select 4;
 
//kill msgs
_victim removeAllEventHandlers "MPHit";
 
_victim = _this select 2;
_victimName = _victim getVariable["bodyName", "nil"];
 
_killer = _victim getVariable["AttackedBy", "nil"];
_killerName = _victim getVariable["AttackedByName", "nil"];
 
// when a zombie kills a player _killer, _killerName and _weapon will be "nil"
// we can use this to determine a zombie kill and send a customized message for that. right now no killmsg means it was a zombie.
if (_killerName != "nil") then
{
    _weapon = _victim getVariable["AttackedByWeapon", "nil"];
    _distance = _victim getVariable["AttackedFromDistance", "nil"];
 
    if (_victimName == _killerName) then
    {
        _message = format["%1 killed himself",_victimName];
        _loc_message = format["PKILL: %1 killed himself", _victimName];
    }
    else
    {
        _message = format["%1 was killed by %2 with weapon %3",_victimName, _killerName, _weapon];
        _loc_message = format["PKILL: %1 was killed by %2 with weapon %3 from %4m", _victimName, _killerName, _weapon, _distance];
    };
 
    diag_log _loc_message;
    //[nil, nil, rspawn, [_killer, _message], { (_this select 0) globalChat (_this select 1) }] call RE;
    //[nil, nil, rHINT, [_killer, _message], { (_this select 0) globalChat (_this select 1) }] call RE;
    [nil, nil, rHINT, _message] call RE;
 
    // Cleanup
    _victim setVariable["AttackedBy", "nil", true];
    _victim setVariable["AttackedByName", "nil", true];
    _victim setVariable["AttackedByWeapon", "nil", true];
    _victim setVariable["AttackedFromDistance", "nil", true];
};
//end of ^^ kill msgs
 
Back
Top