xXxWarFacexXx
Member
Okay before we get started, i want to thank the modding community and dayz.st, dayz.codeit and a few other people who posted the code here. I'm going to walk you through this one step at a time. This Tut is meant for those want to find out how to do this fast and effective.
Step 1.
Open your dayz_mission and edit your init.sqf file to the following
Find
change to
Step 2.
Find this in your fn_selfActions
And // it out like so
Now before we move on i want you to create a new fnc_plyrHit.sqf or replace the one you already have with this code
Step 3.
Open your dayz_server.pbo and look in the init folder and edit the server_functions.sqf file and find
Add this right below that
Step 4.
Open your dayz_server.pbo and go to your compiles folder and open the file server_playerDied.sqf and find
Replace it with
Step 5.
Open your dayz_server.pbo and open the folder compile then edit the server_playerSetup.sqf file and find
Replace it with
Step 6.
Now this code is going to debate weather or not your going to show if a player died by another player or not or just the weapon. Open your day_server.pbo and look in folder compiles and edit server_playerDied.sqf, edit the line
If you just want the player was killed with weapon instead of who killed them, replace the top code with
replace with
Now last but not least, open your battleye/remoteexec.txt
find the following line
replace with
Again thanks to the community for everything hope this helps and you don't have to run around everywhere to try to find out how to do this. If you would like to see future tut please give me a message or post below!
Step 1.
Open your dayz_mission and edit your init.sqf file to the following
Find
Code:
enableRadio false;
Code:
//enableRadio false;
Step 2.
Find this in your fn_selfActions
Code:
#include "\z\addons\dayz_code\system\REsec.sqf"
Code:
//#include "\z\addons\dayz_code\system\REsec.sqf"
Now before we move on i want you to create a new fnc_plyrHit.sqf or replace the one you already have with this code
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];
Step 3.
Open your dayz_server.pbo and look in the init folder and edit the server_functions.sqf file and find
Code:
server_updateNearbyObjects = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_updateNearbyObjects.sqf";
Code:
fnc_plyrHit = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\fnc_plyrHit.sqf";
Step 4.
Open your dayz_server.pbo and go to your compiles folder and open the file server_playerDied.sqf and find
Code:
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 = name _newObject;
//dayz_disco = dayz_disco - [_playerID];
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 = name _newObject;
_victim removeAllEventHandlers "MPHit";
_victim = _this select 2;
_victimName = _playerName;
_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, rTITLETEXT, _message, "PLAIN DOWN", 0] 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];
Step 5.
Open your dayz_server.pbo and open the folder compile then edit the server_playerSetup.sqf file and find
Code:
if (isNull _playerObj) exitWith {
diag_log ("SETUP INIT FAILED: Exiting, player object null: " + str(_playerObj));
};
if (_playerID == "") then {
_playerID = getPlayerUID _playerObj;
};
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;
};
Step 6.
Now this code is going to debate weather or not your going to show if a player died by another player or not or just the weapon. Open your day_server.pbo and look in folder compiles and edit server_playerDied.sqf, edit the line
Code:
_message = format["%1 was killed by %2 with weapon %3 from %4m",_victimName, _killerName, _weapon, _distance];
Code:
_message = format["%1 was killed with weapon %3 from %4m",_victimName, _killerName, _weapon, _distance];
Battleye Edits
Open your battleye/mpeventhandler.txt
find the following line
Code:
5 "spawn" !="spawn BIS_Effects_AirDestruction" !="spawn BIS_Effects_AirDestructionStage2" !="spawn BIS_Effects_Burn"
5 "this" !="this enableSimulation false;this allowDammage false;this disableAI 'FSM';this disableAI 'ANIM';this disableAI 'MOVE';" !="_v setVehicleInit format [\"[this, %1, %2,false,true]spawn BIS_Effects_Burn\",_int, _t];" !="_v setVehicleInit \"[this] spawn BIS_Effects_AirDestruction\";" !="if((local(_this select 0))or(isServer))then{_this call fnc_plyrHit_local;};" !="if(local(_this select 0))then{_this call fnc_plyrDead_local;};"
Code:
1 "spawn" !="spawn BIS_Effects_AirDestruction" !="spawn BIS_Effects_AirDestructionStage2" !="spawn BIS_Effects_Burn" !="spawn fnc_plyrHit" !"fnc_plyrHit.sqf" !"server_playerSetup.sqf" !"server_playerDied.sqf"
1 "this" !="this enableSimulation false;this allowDammage false;this disableAI 'FSM';this disableAI 'ANIM';this disableAI 'MOVE';" !="this spawn fnc_plyrHit" !="_v setVehicleInit format [\"[this, %1, %2,false,true]spawn BIS_Effects_Burn\",_int, _t];" !="_v setVehicleInit \"[this] spawn BIS_Effects_AirDestruction\";" !="if((local(_this select 0))or(isServer))then{_this call fnc_plyrHit_local;};" !="if(local(_this select 0))then{_this call fnc_plyrDead_local;};"
Now last but not least, open your battleye/remoteexec.txt
find the following line
Code:
5 fnc_
Code:
1 fnc_
Again thanks to the community for everything hope this helps and you don't have to run around everywhere to try to find out how to do this. If you would like to see future tut please give me a message or post below!