Needing Help with server_playerDied.sqf and getting the correct kill message...

DangerRuss

OpenDayZ Rockstar!
Im currently using this in my server_playerDied.sqf...
Code:
#include "\z\addons\dayz_server\compile\server_toggle_debug.hpp"
 
private ["_characterID","_minutes","_newObject","_playerID","_key", "_killer", "_weapon", "_distance","_loc_message","_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;
 
_newObject setVariable["processedDeath",diag_tickTime];
_newObject setVariable ["bodyName", _playerName, true];
 
_killer = _newObject getVariable["AttackedBy", "nil"];
_killerName = _newObject 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 = _newObject getVariable["AttackedByWeapon", "nil"];
    _distance = _newObject getVariable["AttackedFromDistance", "nil"];
 
    if (_playerName == _killerName) then
    {
        _loc_message = format["PKILL: %1 killed themselves near %2", _playerName, (getPosATL _newObject) call fa_coor2str];
        _message = format["%1 killed themselves near %2", _playerName, (getPosATL _newObject) call fa_coor2str];
        [nil, nil, rTITLETEXT, _message, "PLAIN DOWN", 0] call RE;
    }
    else
    {
        _killerPlayerID = getPlayerUID _killer;
        _loc_message = format["PKILL: %1 (%5) was killed near %7 by %2 (%6) with weapon %3 from %4m", _playerName, _killerName, _weapon, _distance, _playerID, _killerPlayerID, (getPosATL _newObject) call fa_coor2str];
        _message = format[" %1 was killed near %5 by %2 with weapon %3 from %4m", _playerName, _killerName, _weapon, _distance, (getPosATL _newObject) call fa_coor2str];
        [nil, nil, rTITLETEXT, _message, "PLAIN DOWN", 0] call RE;
    };
 
    diag_log _loc_message;
 
    // Cleanup
    _newObject setVariable["AttackedBy", "nil", true];
    _newObject setVariable["AttackedByName", "nil", true];
    _newObject setVariable["AttackedByWeapon", "nil", true];
    _newObject setVariable["AttackedFromDistance", "nil", true];
} else {
    _loc_message = format["PKILL: %1 was killed near %2", _playerName, (getPosATL _newObject) call fa_coor2str];
    _message = format["PKILL: %1 was killed near %2", _playerName, (getPosATL _newObject) call fa_coor2str];
    diag_log _loc_message;
    [nil, nil, rTITLETEXT, _message, "PLAIN DOWN", 0] call RE;
};
 
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;
};
 
#ifdef PLAYER_DEBUG
format ["Player UID#%3 CID#%4 %1 as %5 died at %2",
    _newObject call fa_plr2str, (getPosATL _newObject) call fa_coor2str,
    getPlayerUID _newObject,_characterID,
    typeOf _newObject
];
#endif
 
//dead_bodyCleanup set [count dead_bodyCleanup,_newObject];

Whenever a player kills me all it says is..
Code:
PKILL: DangerRuss was killed near Elektrozavodsk [96:136]

where am I going wrong here? Im trying to get
"DangerRuss was killed by PLAYERNAME with WEAPON from DISTANCE"
 
Ok I was given a better server_playerDied.sqf. Basically just follow these instructions
http://dayz.st/w/Kill_Messages
but use this server_playerDied.sqf
Code:
#include "\z\addons\dayz_server\compile\server_toggle_debug.hpp"
 
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, rspawn, [_killer, _message], { (_this select 0) globalChat (_this select 1) }] 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];
_newObject setVariable ["bodyName", _playerName, true];
 
/*
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;
};
 
#ifdef PLAYER_DEBUG
format ["Player UID#%3 CID#%4 %1 as %5 died at %2",
    _newObject call fa_plr2str, (getPosATL _newObject) call fa_coor2str,
    getPlayerUID _newObject,_characterID,
    typeOf _newObject
];
#endif
 
/*
_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];
 
sleep 600;
deleteVehicle _newObject;
 
I have problems with mine where if u have a certain skin it wont show or it shows only %75 of the time...

Sent from my SGH-M919 using Tapatalk
 
I havent seen any problems concerning skins. From time to time it wont work especially if theres a lot of people. Not much can be done about that
 
This was resolved a long time ago. Someone should really make a guide for this.

http://opendayz.net/index.php?posts/40443

Switching clothes in DayZ is a process of creating a second unit, copying the inventory from the original one to the new one and lastly deleting the old one. The new unit needs the MPHit EH for the death messages which is normally only added when the player logs in.

Wysłane z mojego Nexus 5
 
I dont have any of the things there talking about >.> besides more of a help forum then how to install it
 
Is it that difficult to read?

Add to player_switchModel.sqf

Code:
player addMPEventHandler ["MPHit", {_this spawn fnc_plyrHit;}];

Done. Kill messages working after skin change.


Wysłane z mojego Nexus 5
 
Then your not playing DayZ, since the file is in dayz_code for over 2 years.

Wysłane z mojego Nexus 5
 
Cyrq just to clarify.. Adding that snippet of code to the bottom of player_switchModel.sqf will fix the issue using the method I posted from dayz.st? No other changes required? Just making sure because that thread you linked to was talking about a hint and I like mine global. thanks

LTGNick > dayz_Code >compile > player_switchModel.sqf

also you're previous post you excluded this
Code:
diag_log ("PLAYER: SETUP: Hit Event added after model change");
from this
Code:
player addMPEventHandler ["MPHit", {_this spawn fnc_plyrHit;}];
diag_log ("PLAYER: SETUP: Hit Event added after model change");
Was this intentional or should I include all of it?
 
Add this:

Code:
diag_log ("I'm very rude, no seriously just google it.");

:eek:

Wysłane z mojego Nexus 5
 
Last edited by a moderator:
Then your not playing DayZ, since the file is in dayz_code for over 2 years.
Of course im not playing dayz im playing mario karts.... herp derp bro come on more instructions than just... ADD this to derp file.. but hey thats what you get from a "helpful" and "friendly" staff member who is willing to help :)
 
Of course im not playing dayz im playing mario karts.... herp derp bro come on more instructions than just... ADD this to derp file.. but hey thats what you get from a "helpful" and "friendly" staff member who is willing to help :)
Let's be nice to one another ey, @cyrq is just getting frustrated with you that's all. Let's leave the hostility at bay and discuss this appropriately. Cyrq isn't a staff member by the way, he just moderates the forum for his mod DayZed. None the less, it doesn't give him nor any of you an excuse to behave like children.

Now, continue....
 
Im sorry just had no idea where the switchmodel.sqf was and I was pretty confused but its all good not everyone is always in the best of moods

Sent from my SGH-M919 using Tapatalk
 
Back
Top