Hey, i'm having some problems getting death messages working on my server.
I Used this: http://dayz.st/w/Kill_Messages
However everything was already set up like that, so just did it again to make sure it was correct but death messages still aren't appearing.
It just Says "Player has Died" and if you check the RPT log it just says "PDEATH: Player Died"
i did manage to get them working once, but it was completely random, sometimes it would just say "Player has Died" and other times it would say "Player was Killed by Player With Weapon X"
Anyone have any idea whats causing this?
Some information:
Init.sqf:
fnc_plyrHit.sqf
server_functions.sqf
server_playerdied.sqf
server_playersetup.sqf
Thanks.
Edit: Death Messages Within The Arma Profile are also Set to 1, so they're enabled.
I Used this: http://dayz.st/w/Kill_Messages
However everything was already set up like that, so just did it again to make sure it was correct but death messages still aren't appearing.
It just Says "Player has Died" and if you check the RPT log it just says "PDEATH: Player Died"
i did manage to get them working once, but it was completely random, sometimes it would just say "Player has Died" and other times it would say "Player was Killed by Player With Weapon X"
Anyone have any idea whats causing this?
Some information:
Init.sqf:
Code:
player setVariable ["BIS_noCoreConversations", true];
//enableRadio false;
fnc_plyrHit.sqf
Code:
private ["_victim", "_attacker","_weapon","_distance","_victimPlayerID","_attakerPlayerID"];
_victim = _this select 0;
_attacker = _this select 1;
if (!isPlayer _victim || !isPlayer _attacker) exitWith {};
if ((name _victim) == (name _attacker)) exitWith {};
_weapon = weaponState _attacker;
if (_weapon select 0 == "Throw") then
{
_weapon = _weapon select 3;
}
else
{
_weapon = _weapon select 0;
};
_distance = _victim distance _attacker;
_victimPlayerID = getPlayerUID _victim;
_attakerPlayerID = getPlayerUID _attacker;
diag_log format["PHIT: %1 (%5) was hit by %2 (%6) with %3 from %4m", _victim, _attacker, _weapon, _distance, _victimPlayerID, _attakerPlayerID];
_victim setVariable["AttackedBy", _attacker, true];
_victim setVariable["AttackedByName", (name _attacker), true];
//_victim setVariable["AttackedByWeapon", (currentWeapon _attacker), true];
_victim setVariable["AttackedByWeapon", _weapon, true];
_victim setVariable["AttackedFromDistance", _distance, true];
server_functions.sqf
Code:
fnc_plyrHit = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\fnc_plyrHit.sqf";
server_playerdied.sqf
Code:
private["_characterID","_minutes","_newObject","_playerID","_key","_playerName","_playerID","_myGroup","_group","_victim", "_killer", "_weapon", "_message", "_distance","_loc_message","_victimName","_killerName","_killerPlayerID"];
//[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;
_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
{
_killerPlayerID = getPlayerUID _killer;
_message = format["%1 was killed by %2 with weapon %3 from %4m",_victimName, _killerName, _weapon, _distance];
_loc_message = format["PKILL: %1 (%5) was killed by %2 (%6) with weapon %3 from %4m", _victimName, _killerName, _weapon, _distance, _playerID, _killerPlayerID];
};
diag_log _loc_message;
[nil, nil, rspawn, [_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];
};
dayz_disco = dayz_disco - [_playerID];
_newObject setVariable["processedDeath",time];
/*
diag_log ("DW_DEBUG: (isnil _characterID): " + str(isnil "_characterID"));
if (isnil "_characterID") then {
diag_log ("DW_DEBUG: _newObject: " + str(_newObject));
};
*/
if (typeName _minutes == "STRING") then
{
_minutes = parseNumber _minutes;
};
if (_characterID != "0") then
{
_key = format["CHILD:202:%1:%2:",_characterID,_minutes];
//diag_log ("HIVE: WRITE: "+ str(_key));
_key call server_hiveWrite;
}
else
{
deleteVehicle _newObject;
};
diag_log ("PDEATH: Player Died " + _playerID);
/*
_eh = [_newObject] spawn {
_body = _this select 0;
_method = _body getVariable["deathType","unknown"];
_name = _body getVariable["bodyName","unknown"];
waitUntil{!isPlayer _body;sleep 1};
_body setVariable["deathType",_method,true];
_body setVariable["bodyName",_name,true];
diag_log ("PDEATH: Player Left Body " + _name);
};
*/
//dead_bodyCleanup set [count dead_bodyCleanup,_newObject];
server_playersetup.sqf
Code:
if (isNull _playerObj) exitWith {
diag_log ("SETUP INIT FAILED: Exiting, player object null: " + str(_playerObj));
};
//Add MPHit event handler
diag_log("Adding MPHit EH for " + str(_playerObj));
_playerObj addMPEventHandler ["MPHit", {_this spawn fnc_plyrHit;}];
if (_playerID == "") then {
_playerID = getPlayerUID _playerObj;
};
Thanks.
Edit: Death Messages Within The Arma Profile are also Set to 1, so they're enabled.