speedweasel 276 Report post Posted April 15, 2016 (edited) *****EDIT 15/ July 2016***** ---> As of v0.9.8, this code no longer works. Currently, players killed by a RyanZombie generate a suicide notice in the kill feed. I've modified the ExileServer_object_player_event_onMpKilled.sqf file to generate "Eaten by a Zombie," kill feed messages when it's *likely* a player was eaten by a zombie. (I don't think there is a fool-proof way to determine a zombie kill but I'm happy to be proven wrong.) Overwrite the ExileServer_object_player_event_onMpKilled function using the CustomCode {} feature in your mission config.cpp file. This is standard practice; Google "CustomCode Exile" for details. ExileServer_object_player_event_onMpKilled.sqf: Spoiler /** * ExileServer_object_player_event_onMpKilled * * Exile Mod * exile.majormittens.co.uk * © 2015 Exile Mod Team * * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/. */ private["_zombieKill","_zombie","_bystanders","_weapon","_victimNear","_locationNames","_victim","_killer","_victimPosition","_addDeathStat","_addKillStat","_normalkill","_killerRespectPoints","_fragAttributes","_player","_grpvictim","_grpkiller","_log","_lastVictims","_victimUID","_vehicleRole","_vehicle","_lastKillAt","_killStack","_distance","_distanceBonus","_flagNextToKiller","_homieBonus","_flagNextToVictim","_raidBonus","_overallRespectChange","_newKillerScore","_killMessage","_newKillerFrags","_newVictimDeaths"]; if (!isServer || hasInterface) exitWith {}; _victim = _this select 0; _killer = _this select 1; diag_log format ["%1 killed %2", _killer, _victim]; if( isNull _victim ) exitWith {}; _victim setVariable ["ExileDiedAt", time]; if !(isPlayer _victim) exitWith {}; _victimPosition = getPos _victim; _distance = floor(_victim distance _killer); _locationNames = nearestLocations [getPos _victim, ["NameVillage","NameCity","NameCityCapital"], 4000]; _victimNear = text (_locationNames select 0); _weapon = currentWeapon _killer; format["insertPlayerHistory:%1:%2:%3:%4:%5", getPlayerUID _victim, name _victim, _victimPosition select 0, _victimPosition select 1, _victimPosition select 2] call ExileServer_system_database_query_fireAndForget; format["deletePlayer:%1", _victim getVariable ["ExileDatabaseId", -1]] call ExileServer_system_database_query_fireAndForget; _victim setVariable ["ExileIsDead", true]; _victim setVariable ["ExileName", name _victim, true]; _victim call ExileServer_object_flies_spawn; _addDeathStat = true; _addKillStat = true; _normalkill = true; _killerRespectPoints = []; _fragAttributes = []; _zombieKill = false; if (_victim isEqualTo _killer) then { _bystanders = _victimPosition nearEntities ['Man',3]; {_zombie = getText(configFile >> 'CfgVehicles' >> typeOf _x >> 'author') isEqualTo 'Ryan'; if(_zombie)then { _zombieKill = true; }; } forEach _bystanders; if (_zombieKill) then { ["systemChatRequest", [format["%1 was eaten by a zombie!", (name _victim)]]] call ExileServer_object_player_event_killFeed; } else { ["systemChatRequest", [format["%1 comitted suicide!", (name _victim)]]] call ExileServer_object_player_event_killFeed; }; } else { if (vehicle _victim isEqualTo _killer) then { ["systemChatRequest", [format["%1 crashed!", (name _victim)]]] call ExileServer_object_player_event_killfeed; } else { if (isNull _killer) then { ["systemChatRequest", [format["%1 died for an unknown reason! Maybe a zombie?", (name _victim)]]] call ExileServer_object_player_event_killfeed; } else { _player = objNull; if (isPlayer _killer) then { if ((typeOf _killer) isEqualTo "Exile_Unit_Player") then { _player = _killer; } else { _uid = getPlayerUID _killer; { if ((getPlayerUID _x) isEqualTo _uid) exitWith { _player = _x; }; } forEach allPlayers; }; } else { if (isUAVConnected _killer) then { _player = (UAVControl _killer) select 0; }; }; if !(isNull _player) then { _killer = _player; if (_victim getVariable ["ExileIsBambi", false]) then { _addKillStat = false; _addDeathStat = false; _fragAttributes pushBack "Bambi Slayer"; _killerRespectPoints pushBack ["BAMBI SLAYER", (getNumber (configFile >> "CfgSettings" >> "Respect" >> "Frags" >> "bambi"))]; } else { _grpvictim = _victim getVariable ["ExileGroup",(group _victim)]; _grpkiller = _killer getVariable ["ExileGroup",(group _killer)]; if((_grpvictim isEqualTo _grpkiller)&&!(ExileGraveyardGroup isEqualTo _grpkiller))then { _log = format["%2 was team-killed by %1!", (name _killer), (name _victim)]; ["systemChatRequest", [_log]] call ExileServer_object_player_event_killfeed; _fragAttributes pushBack "Teamkill"; _killerRespectPoints pushBack ["TEAMKILL", (getNumber (configFile >> "CfgSettings" >> "Respect" >> "Frags" >> "friendlyFire"))]; _normalkill = false; } else { _lastVictims = _killer getVariable ["ExileLastVictims", ["0", "1", "2"]]; _victimUID = _victim getVariable ["ExileOwnerUID", getPlayerUID _victim]; if (_victimUID in _lastVictims) then { _log = format["%1 keeps killing %2!", (name _killer), (name _victim)]; ["systemChatRequest", [_log]] call ExileServer_object_player_event_killfeed; _fragAttributes pushBack "Domination"; _killerRespectPoints pushBack ["DOMINATION BONUS", (getNumber (configFile >> "CfgSettings" >> "Respect" >> "Frags" >> "domination"))]; } else { _lastVictims deleteAt 0; _lastVictims pushBack _victimUID; _killer setVariable ["ExileLastVictims", _lastVictims]; if ((vehicle _killer) isEqualTo _killer) then { if ((currentWeapon _killer) isEqualTo "Exile_Melee_Axe") then { _fragAttributes pushBack "Humiliation"; _killerRespectPoints pushBack ["HUMILIATION", (getNumber (configFile >> "CfgSettings" >> "Respect" >> "Frags" >> "humiliation"))]; } else { _killerRespectPoints pushBack ["ENEMY FRAGGED", (getNumber (configFile >> "CfgSettings" >> "Respect" >> "Frags" >> "standard"))]; }; } else { _vehicleRole = assignedVehicleRole _killer; switch (toLower (_vehicleRole select 0)) do { case "driver": { _vehicle = vehicle _killer; switch (true) do { case (_vehicle isKindOf "ParachuteBase"): { _fragAttributes pushBack "Chute > Chopper"; _killerRespectPoints pushBack ["CHUTE > CHOPPER", (getNumber (configFile >> "CfgSettings" >> "Respect" >> "Frags" >> "chuteGreaterChopper"))]; }; case (_vehicle isKindOf "Air"): { _fragAttributes pushBack "Big Bird"; _killerRespectPoints pushBack ["BIG BIRD", (getNumber (configFile >> "CfgSettings" >> "Respect" >> "Frags" >> "bigBird"))]; }; default { _fragAttributes pushBack "Road Kill"; _killerRespectPoints pushBack ["ROAD KILL", (getNumber (configFile >> "CfgSettings" >> "Respect" >> "Frags" >> "roadKill"))]; }; }; }; case "turret": { if ((currentWeapon _killer) isKindOf "StaticWeapon") then { _fragAttributes pushBack "Let it Rain"; _killerRespectPoints pushBack ["LET IT RAIN", (getNumber (configFile >> "CfgSettings" >> "Respect" >> "Frags" >> "letItRain"))]; } else { _fragAttributes pushBack "Mad Passenger"; _killerRespectPoints pushBack ["MAD PASSENGER", (getNumber (configFile >> "CfgSettings" >> "Respect" >> "Frags" >> "passenger"))]; }; }; default { _fragAttributes pushBack "Mad Passenger"; _killerRespectPoints pushBack ["MAD PASSENGER", (getNumber (configFile >> "CfgSettings" >> "Respect" >> "Frags" >> "passenger"))]; }; }; }; }; }; }; if (_addKillStat) then { if(_normalkill)then { _lastKillAt = _killer getVariable ["ExileLastKillAt", 0]; _killStack = _killer getVariable ["ExileKillStack", 0]; _killStack = _killStack + 1; if (isNil "ExileServerHadFirstBlood") then { ExileServerHadFirstBlood = true; _fragAttributes pushBack "First Blood"; _killerRespectPoints pushBack ["FIRST BLOOD", getNumber (configFile >> "CfgSettings" >> "Respect" >> "Bonus" >> "firstBlood")]; } else { if (time - _lastKillAt < (getNumber (configFile >> "CfgSettings" >> "Respect" >> "Bonus" >> "killStreakTimeout"))) then { _fragAttributes pushBack (format ["%1x Kill Streak", _killStack]); _killerRespectPoints pushBack [(format ["%1x KILL STREAK", _killStack]), _killStack * (getNumber (configFile >> "CfgSettings" >> "Respect" >> "Bonus" >> "killStreak"))]; } else { _killStack = 1; }; }; _killer setVariable ["ExileKillStack", _killStack]; _killer setVariable ["ExileLastKillAt", time]; }; // _distance = floor(_victim distance _killer); _fragAttributes pushBack (format ["%1m Range", _distance]); _distanceBonus = (floor ((_distance min 3000) / 100)) * getNumber (configFile >> "CfgSettings" >> "Respect" >> "Bonus" >> "per100mDistance"); if (_distanceBonus > 0) then { _killerRespectPoints pushBack [(format ["%1m RANGE BONUS", _distance]), _distanceBonus]; }; _flagNextToKiller = _killer call ExileClient_util_world_getTerritoryAtPosition; if !(isNull _flagNextToKiller) then { if ((getPlayerUID _killer) in (_flagNextToKiller getVariable ["ExileTerritoryBuildRights", []])) then { _homieBonus = getNumber (configFile >> "CfgSettings" >> "Respect" >> "Bonus" >> "homie"); if (_homieBonus > 0) then { _fragAttributes pushBack "Homie"; _killerRespectPoints pushBack ["HOMIE BONUS", _homieBonus]; }; }; }; _flagNextToVictim = _victim call ExileClient_util_world_getTerritoryAtPosition; if !(isNull _flagNextToVictim) then { if ((getPlayerUID _victim) in (_flagNextToVictim getVariable ["ExileTerritoryBuildRights", []])) then { _raidBonus = getNumber (configFile >> "CfgSettings" >> "Respect" >> "Bonus" >> "raid"); if (_raidBonus > 0) then { _fragAttributes pushBack "Raid"; _killerRespectPoints pushBack ["RAID BONUS", _raidBonus]; }; }; }; }; _overallRespectChange = 0; { _overallRespectChange = _overallRespectChange + (_x select 1); } forEach _killerRespectPoints; _newKillerScore = _killer getVariable ["ExileScore", 0]; _newKillerScore = _newKillerScore + _overallRespectChange; _killer setVariable ["ExileScore", _newKillerScore]; format["setAccountScore:%1:%2", _newKillerScore,getPlayerUID _killer] call ExileServer_system_database_query_fireAndForget; if(_normalkill)then { _killMessage = format ["%1 was killed by %2 with %3 near %4", (name _victim), (name _killer), (text _weapon), (text _victimNear)]; if !(count _fragAttributes isEqualTo 0) then { _killMessage = _killMessage + " (" + (_fragAttributes joinString ", ") + ")"; }; ["systemChatRequest", [_killMessage]] call ExileServer_object_player_event_killfeed; if (_addKillStat isEqualTo true) then { _newKillerFrags = _killer getVariable ["ExileKills", 0]; _newKillerFrags = _newKillerFrags + 1; _killer setVariable ["ExileKills", _newKillerFrags]; format["addAccountKill:%1", getPlayerUID _killer] call ExileServer_system_database_query_fireAndForget; }; }; [_killer, "showFragRequest", [_killerRespectPoints]] call ExileServer_system_network_send_to; _killer call ExileServer_object_player_sendStatsUpdate; } else { ["systemChatRequest", [format["%1 was killed by an NPC (%2m Range)", (name _victim), floor(_victim distance _killer)]]] call ExileServer_object_player_event_killfeed; }; }; }; }; if (_addDeathStat isEqualTo true) then { _newVictimDeaths = _victim getVariable ["ExileDeaths", 0]; _newVictimDeaths = _newVictimDeaths + 1; _victim setVariable ["ExileDeaths", _newVictimDeaths]; format["addAccountDeath:%1", getPlayerUID _victim] call ExileServer_system_database_query_fireAndForget; _victim call ExileServer_object_player_sendStatsUpdate; }; [_victim] joinSilent ExileGraveyardGroup; true ps. Note, this file includes my proximity and weapon hint features. These name the nearest location and the weapon used in the kill feed for all PvP kills. You may or may not want to include this... Edited July 14, 2016 by speedweasel 2 Share this post Link to post Share on other sites
kuplion 1785 Report post Posted April 15, 2016 (edited) Thank you for this, @speedweasel. EDIT: This works perfectly!!! Edited April 15, 2016 by kuplion 1 Share this post Link to post Share on other sites
Snakeyes 50 Report post Posted April 15, 2016 This works great. Thanks! 1 Share this post Link to post Share on other sites
Corpulio_Hun 6 Report post Posted May 16, 2016 Work fine! Thx your work! 1 Share this post Link to post Share on other sites
speedweasel 276 Report post Posted May 16, 2016 19 minutes ago, Corpulio_Hun said: Work fine! Thx your work! I've updated this file with a number of new features, here: This version includes the zombie notifications plus a bunch more. 1 Share this post Link to post Share on other sites
Bruiser 12 Report post Posted July 14, 2016 did this ever get updated? for 9.8 or 1.0? Share this post Link to post Share on other sites
speedweasel 276 Report post Posted July 14, 2016 45 minutes ago, Bruiser said: did this ever get updated? for 9.8 or 1.0? Not yet. I wont be updating it any time soon but there are dozens of others who might help... 1 Share this post Link to post Share on other sites