DayZserverAdmin
Member
Open DayZ_Server / Compile / server_playerSetup.sqf find the code
if(isNull _playerObj or!isPlayer _playerObj) exitWith {
diag_log ("SETUP RESULT: Exiting, player object null: "+ str(_playerObj));
};
insert after that
func_PlayerDeath ={
private["_victim","_killer","_weapon"];
_victim = _this select0;
// Exit if victim is not a player
if(!isPlayer _victim) exitWith {};
// Get the vars for killer and the weapon used
_killer = _victim getVariable["AX_AttackedBy","nil"];
_weapon = _victim getVariable["AX_AttackedByWeapon","nil"];
_distance = _victim getVariable["AX_AttackedByDistance","nil"];
_strDistance = format ["%1", _distance];
// no killer found, clean attackedbyweapon var
if(_killer =="nil") exitWith { _victim setVariable["AX_AttackedBy","nil",true]; _victim setVariable["AX_AttackedByWeapon","nil",true];};
// If victim is killer send suicide message otherwise send killed by message
if((name _victim)== _killer)then{
diag_log ((name _victim)+" killed himself");
message ="---------> "+(name _victim)+" killed himself";
}else{
diag_log ("KILLED BY: "+(name _victim)+" by "+ _killer +" with "+ _weapon);
message ="---------> "+(name _victim)+" was killed by "+ _killer +" ["+ _weapon +"] from: "+ _strDistance +"m";
};
// Send message and clean the variables
[message] call func_WhoKilledCrierMessage;
_victim setVariable["AX_AttackedBy","nil",true];
_victim setVariable["AX_AttackedByWeapon","nil",true];
_victim setVariable["AX_AttackedByDistance","nil",true];};
mpkilledeventhandler = _playerObj addMPEventHandler ["MPkilled",{_this call func_PlayerDeath;}];
func_PlayerHit ={
private["_victim","_attacker"];
_victim = _this select0;
_attacker = _this select1;
if(!isPlayer _attacker) exitWith {};
if((name _victim)==(name _attacker)) exitWith {};
_victim setVariable["AX_AttackedBy",(name _attacker),true];
_victim setVariable["AX_AttackedByWeapon",(currentWeapon _attacker),true];
_victim setVariable["AX_AttackedByDistance",(_victim distance _attacker),true];};
mphiteventhandler = _playerObj addMPEventHandler ["MPhit",{_this call func_PlayerHit;}];
Now go to dayz_server / init / server_functions.sqf and go to the very bottem and insert
func_WhoKilledCrierMessage = {
private ["_message"];
_message = (_this select 0);
[nil, nil, rSPAWN, [whoKilledWhoCrier,_message], { (_this select 0) globalChat (_this select 1) }] call RE;
};
Find
//Get instance name (e.g. dayz_1.chernarus)
fnc_instanceName ={
"dayz_"+ str(dayz_instance)+"."+ worldName};
right below that insert
//Spawn the x killed y crierif(isServer)then{
_axet =Creategroup sideLogic;
whoKilledWhoCrier = _axet createUnit ["Survivor2_DZ",[-2500,0,0],[],0,"NONE"];
publicVariable "whoKilledWhoCrier";
diag_log ("(AX) Who Killed Who Server Crier Created");};
Original work was done by: AlienXAXS https://github.com/AlienXAXS
Modified a little more by me.
When its all done it should look somthing like this
----> Spiderman was killed by Batman [M4A1] from 30.1m away
Also im sad to say that this will not be able to work on any other mod than regular dayz
also somtimes there is glitches where it wont appear but most of the time it will appear
if(isNull _playerObj or!isPlayer _playerObj) exitWith {
diag_log ("SETUP RESULT: Exiting, player object null: "+ str(_playerObj));
};
insert after that
func_PlayerDeath ={
private["_victim","_killer","_weapon"];
_victim = _this select0;
// Exit if victim is not a player
if(!isPlayer _victim) exitWith {};
// Get the vars for killer and the weapon used
_killer = _victim getVariable["AX_AttackedBy","nil"];
_weapon = _victim getVariable["AX_AttackedByWeapon","nil"];
_distance = _victim getVariable["AX_AttackedByDistance","nil"];
_strDistance = format ["%1", _distance];
// no killer found, clean attackedbyweapon var
if(_killer =="nil") exitWith { _victim setVariable["AX_AttackedBy","nil",true]; _victim setVariable["AX_AttackedByWeapon","nil",true];};
// If victim is killer send suicide message otherwise send killed by message
if((name _victim)== _killer)then{
diag_log ((name _victim)+" killed himself");
message ="---------> "+(name _victim)+" killed himself";
}else{
diag_log ("KILLED BY: "+(name _victim)+" by "+ _killer +" with "+ _weapon);
message ="---------> "+(name _victim)+" was killed by "+ _killer +" ["+ _weapon +"] from: "+ _strDistance +"m";
};
// Send message and clean the variables
[message] call func_WhoKilledCrierMessage;
_victim setVariable["AX_AttackedBy","nil",true];
_victim setVariable["AX_AttackedByWeapon","nil",true];
_victim setVariable["AX_AttackedByDistance","nil",true];};
mpkilledeventhandler = _playerObj addMPEventHandler ["MPkilled",{_this call func_PlayerDeath;}];
func_PlayerHit ={
private["_victim","_attacker"];
_victim = _this select0;
_attacker = _this select1;
if(!isPlayer _attacker) exitWith {};
if((name _victim)==(name _attacker)) exitWith {};
_victim setVariable["AX_AttackedBy",(name _attacker),true];
_victim setVariable["AX_AttackedByWeapon",(currentWeapon _attacker),true];
_victim setVariable["AX_AttackedByDistance",(_victim distance _attacker),true];};
mphiteventhandler = _playerObj addMPEventHandler ["MPhit",{_this call func_PlayerHit;}];
Now go to dayz_server / init / server_functions.sqf and go to the very bottem and insert
func_WhoKilledCrierMessage = {
private ["_message"];
_message = (_this select 0);
[nil, nil, rSPAWN, [whoKilledWhoCrier,_message], { (_this select 0) globalChat (_this select 1) }] call RE;
};
Find
//Get instance name (e.g. dayz_1.chernarus)
fnc_instanceName ={
"dayz_"+ str(dayz_instance)+"."+ worldName};
right below that insert
//Spawn the x killed y crierif(isServer)then{
_axet =Creategroup sideLogic;
whoKilledWhoCrier = _axet createUnit ["Survivor2_DZ",[-2500,0,0],[],0,"NONE"];
publicVariable "whoKilledWhoCrier";
diag_log ("(AX) Who Killed Who Server Crier Created");};
Original work was done by: AlienXAXS https://github.com/AlienXAXS
Modified a little more by me.
When its all done it should look somthing like this
----> Spiderman was killed by Batman [M4A1] from 30.1m away
Also im sad to say that this will not be able to work on any other mod than regular dayz
also somtimes there is glitches where it wont appear but most of the time it will appear
Last edited: