Jump to content
  • 0

Modifying Halvhjearne's Killfeed


natoed

Question

from here

Greeting to All,

Whist I love the killfeed, its lacking as epoch has grown. Wanting to add killed/eaten by zombie to the killfeed.

First of just adding ryan's zombie then added sm zombz and epoch's zombies.

I've tried a couple of time but failing hard.

I just can not get my head around all the nested if and else statements, most likely have inserted code in the wrong spot again.

so here's what I've got so far from line 143 (notepad ++).

File in question - halv_fnc_playerdied.sqf

Any and all help would be great, thanks

 

cheers

natoed

 

Spoiler

/*
	a3 epoch killfeed server function
	By Halv
	
	Copyright (C) 2015  Halvhjearne > README.md
*/
#include "settings.sqf";

private ["_weapon","_player","_killer","_distance","_victimName","_killerName","_txt","_pic","_vehicleKillerType","_zombie","_zombieKill"];

_player = _this select 1 select 0;
_killer = _this select 1 select 1;
//diag_log format["[KillFeed] halv_fnc_playerdied.sqf server function triggered for player %1 and killer %2",_player,_killer];

_player setVariable ["bodyUID", getPlayerUID _player, true];

_message = "";
_dyntxt = "";
_loc_message = "";
_hint = "";

_killerName = name _killer;
_victimName = name _player;

_distance = _player distance _killer;

_weapon = currentWeapon _killer;

_infostudy = [_killerName,_victimName,serverTime];

if (!(_killer isEqualTo _player) && !((vehicle _killer) isEqualTo (vehicle _player)))then{
	//if killer is not vehicle
	_txt = (gettext (configFile >> 'cfgWeapons' >> _weapon >> 'displayName'));
	_pic = (gettext (configFile >> 'cfgWeapons' >> _weapon >> 'picture'));
	_vehicleKillerType = typeOf(vehicle _killer);

	//if killer is a vehicle type, then we get vehicle picture
	{
		if(_vehicleKillerType isKindOf _x)exitWith{
			_pic = (gettext (configFile >> 'CfgVehicles' >> _vehicleKillerType >> 'picture'));
			//and if he was in a driver position of the vehicle, we get vehicle displayName aswell
			if(_killer isEqualTo (driver(vehicle _killer)))then{
				_txt = (gettext (configFile >> 'CfgVehicles' >> _vehicleKillerType >> 'displayName'));
			};
		};
	}count ["LandVehicle","Air","Ship"];

	//if weapon is a horn classname, then the killer was also driver, so we get vehicle displayName instead of weapon displayName
	if(_weapon in ["Horn","MiniCarHorn","SportCarHorn","TruckHorn2","TruckHorn","BikeHorn","CarHorn","TruckHorn3"])then{
		_txt = (gettext (configFile >> 'CfgVehicles' >> _vehicleKillerType >> 'displayName'));
	};
	_infostudy pushBack _pic;
	_infostudy pushBack _txt;
	//if leader of killer group was a player, then we are almost certain killer was a player, so we create a message
	if(isPlayer leader(group _killer))then{
		_dyntxt = format["
		<t size='0.75'align='left'shadow='1'color='#5882FA'>%1</t>
		<t size='0.5'align='left'shadow='1'>  Killed  </t>
		<t size='0.75'align='left'shadow='1'color='#c70000'>%2</t><br/>
		<t size='0.45'align='left'shadow='1'> With: </t>
		<t size='0.5'align='left'shadow='1'color='#FFCC00'>%3</t>
		<t size='0.45'align='left'shadow='1'> - Distance: </t>
		<t size='0.5'align='left'shadow='1'color='#FFCC00'>%4m</t><br/>
		<img size='2.5'align='left'shadow='1'image='%5'/>
		",
		_killerName,
		_victimName,
		_txt,
		_distance,
		_pic
		];

		_hint = parseText format ["
			<t size='1.25'align='center'shadow='1'color='#5882FA'>%1</t><br/>
			<t size='1'align='Center'shadow='1'>Killed:</t><br/>
			<t size='1.25'align='Center'shadow='1'color='#c70000'>%2</t><br/>
			<t size='1'align='Center'shadow='1'>With Weapon:</t><br/>
			<img size='5'shadow='1'image='%3'/><br/>
			<t size='1.25'align='Center'shadow='1'>[</t><t size='1.25'align='Center'shadow='1'color='#FFCC00'>%4</t><t size='1.25'align='Center'shadow='1'>]</t><br/>
			<t size='1'align='Center'shadow='1'>Distance:</t><br/>
			<t size='1.25'align='Center'shadow='1'color='#FFCC00'>%5m</t><br/>",
			_killerName,
			_victimName,
			_pic,
			_txt,
			_distance
		];
		_message = format["%1 was killed by %2 with %3 from %4m",_victimName, _killerName, _txt, _distance];
		_loc_message = format["[KillFeed]: PKILL: %1 was killed by %2 with %3 from %4m", _victimName, _killerName, _weapon, _distance];
	}else{
		if(_HALV_KillFeed_AI)then{
			//killer is not a player
			_killerType = typeOf _killer;
			if !((gettext (configFile >> 'CfgVehicles' >> _killerType >> 'displayName')) isEqualTo "")then{
				_killerName = gettext (configFile >> 'CfgVehicles' >> _killerType >> 'displayName');
			};
			if(_killerName isEqualTo "Error: No vehicle")then{
				_nearkillerobjs = nearestObjects [_player,["Epoch_Sapper_F","Epoch_SapperB_F","Epoch_SapperG_F","test_EmptyObjectForFireBig","Bo_Mk82","Rocket_03_HE_F","M_Mo_82mm_AT_LG","Bo_GBU12_LGB","Bo_GBU12_LGB_MI10","HelicopterExploSmall"],10];
				if(count _nearkillerobjs > 0)exitWith{
					_nearestkillerobj = _nearkillerobjs select 0;
					_killerName = gettext (configFile >> 'CfgVehicles' >> (typeOf _nearestkillerobj) >> 'displayName');
					_distance = 0;
					_txt = switch(typeOf _nearestkillerobj)do{
						case "Epoch_Sapper_F":{"Explosion"};
						case "Epoch_SapperB_F":{"Explosion"};
						case "Epoch_SapperG_F":{"Explosion"};
						case "Bo_Mk82":{"Explosion"};
						case "Rocket_03_HE_F":{"Explosion"};
						case "M_Mo_82mm_AT_LG":{"Explosion"};
						case "Bo_GBU12_LGB":{"Explosion"};
						case "Bo_GBU12_LGB_MI10":{"Explosion"};
						case "HelicopterExploSmall":{"Explosion"};
						case "test_EmptyObjectForFireBig":{"Fire"};
						default{"Explosion or Fire"};
					};
				};

//				if(typeName _killer isEqualTo "OBJECT")exitWith{};

			};
			_message = format["%1 was killed by a %2 with %3 from %4m",_victimName,_killerName,_txt,_distance];
			if(_killerName isEqualTo "Error: No vehicle") then {
					_hint = parseText format["<t align='Center'shadow='2'>%1</t>",_message];		
			} else {  // assume the killer was an armed AI
				_hint = parseText format ["
					<t size='1.25'align='center'shadow='1'color='#5882FA'>%1</t><br/>
					<t size='1'align='Center'shadow='1'>Killed:</t><br/>
					<t size='1.25'align='Center'shadow='1'color='#c70000'>%2</t><br/>
					<t size='1'align='Center'shadow='1'>With Weapon:</t><br/>
					<img size='5'shadow='1'image='%3'/><br/>
					<t size='1.25'align='Center'shadow='1'>[</t><t size='1.25'align='Center'shadow='1'color='#FFCC00'>%4</t><t size='1.25'align='Center'shadow='1'>]</t><br/>
					<t size='1'align='Center'shadow='1'>Distance:</t><br/>
					<t size='1.25'align='Center'shadow='1'color='#FFCC00'>%5m</t><br/>",
					_killerName,
					_victimName,
					_pic,
					_txt,
					_distance
				];
			};
			_dyntxt = format["<t size='0.70'align='left'shadow='1'>%1</t>",_message];
			_loc_message = format["[KillFeed]: PKILL: %1 | %2",_message,_killerType];
			if (_victim isEqualTo _killer) then
			{
				_killer = _player nearEntities ['Man',3];
				{_zombie = getText(configFile >> 'CfgVehicles' >> typeOf _x >> 'author') isEqualTo 'Ryan';
				if(_zombie)then {
					_zombieKill = true;};
				}forEach _killer;
				if (_zombieKill) then {
				//if player is killed by zombie
				_message = format["%1 was eaten by zombies",name _player];
				_hint = parseText format["<t align='Center'shadow='2'>%1</t>",_message];
				_dyntxt = format["<t size='0.70'align='left'shadow='1'>%1</t>",_message];
				_loc_message = format["[KillFeed]: PKILL: %1 was eaten by zombies| '%2' - '%3'", _victimName,_killer,_weapon];
				};
			};
		};
	};		
}else{
	//if player is killer
	_message = format["%1 died for an unknown reason!",name _player];
	_hint = parseText format["<t align='Center'shadow='2'>%1</t>",_message];
	_dyntxt = format["<t size='0.70'align='left'shadow='1'>%1</t>",_message];
	_loc_message = format["[KillFeed]: PKILL: %1 died for an unknown reason!| '%2' - '%3'", _victimName,_killer,_weapon];
};

_player setVariable ["HALV_STUDY",_infostudy, true];

if(_loc_message isEqualTo "")then{_loc_message = format["[KillFeed]: PKILL: %1 was killed by %2 with %3",_player,_killer,_weapon];};

diag_log _loc_message;

if !(_message isEqualTo "")then{
	{
		if(_x select 0) then {
			HalvPV_player_message = (_x select 1);
			publicVariable "HalvPV_player_message";
		};
	}forEach[
		[_HALV_KillFeedhint,["hint", _hint]],[_HALV_KillFeedhintSilent,["hintSilent", _hint]],[_HALV_KillFeedsystemChat,["systemChat", _message]],
		[_HALV_KillFeeddynamictext,["dynamictext", _dyntxt]],[_HALV_KillFeedsideChat,["sideChat", _message, _killer]],
		[_HALV_KillFeedglobalChat,["globalChat", _message, _killer]],[_HALV_KillFeedcutText,["cutText", [_message, "PLAIN DOWN"]]],
		[_HALV_KillFeedtitleText,["titleText", [_message, "PLAIN DOWN"]]]
	];
};

 

 

 

 

Edited by natoed
updated
Link to comment
Share on other sites

12 answers to this question

Recommended Posts

  • 1

Here's your test code.

 

/*
	a3 epoch killfeed server function
	By Halv
	
	Copyright (C) 2015  Halvhjearne > README.md
*/
#include "settings.sqf";

private ["_weapon","_player","_killer","_distance","_victimName","_killerName","_txt","_pic","_vehicleKillerType","_zombie","_zombieKill"];

_player = _this select 1 select 0;
_killer = _this select 1 select 1;
//diag_log format["[KillFeed] halv_fnc_playerdied.sqf server function triggered for player %1 and killer %2",_player,_killer];

_player setVariable ["bodyUID", getPlayerUID _player, true];

_message = "";
_dyntxt = "";
_loc_message = "";
_hint = "";

_killerName = name _killer;
_victimName = name _player;

_distance = _player distance _killer;

_weapon = currentWeapon _killer;

_infostudy = [_killerName,_victimName,serverTime];

if (!(_killer isEqualTo _player) && !((vehicle _killer) isEqualTo (vehicle _player)))then{
	//if killer is not vehicle
	_txt = (gettext (configFile >> 'cfgWeapons' >> _weapon >> 'displayName'));
	_pic = (gettext (configFile >> 'cfgWeapons' >> _weapon >> 'picture'));
	_vehicleKillerType = typeOf(vehicle _killer);

	//if killer is a vehicle type, then we get vehicle picture
	{
		if(_vehicleKillerType isKindOf _x)exitWith{
			_pic = (gettext (configFile >> 'CfgVehicles' >> _vehicleKillerType >> 'picture'));
			//and if he was in a driver position of the vehicle, we get vehicle displayName aswell
			if(_killer isEqualTo (driver(vehicle _killer)))then{
				_txt = (gettext (configFile >> 'CfgVehicles' >> _vehicleKillerType >> 'displayName'));
			};
		};
	}count ["LandVehicle","Air","Ship"];

	//if weapon is a horn classname, then the killer was also driver, so we get vehicle displayName instead of weapon displayName
	if(_weapon in ["Horn","MiniCarHorn","SportCarHorn","TruckHorn2","TruckHorn","BikeHorn","CarHorn","TruckHorn3"])then{
		_txt = (gettext (configFile >> 'CfgVehicles' >> _vehicleKillerType >> 'displayName'));
	};
	_infostudy pushBack _pic;
	_infostudy pushBack _txt;
	//if leader of killer group was a player, then we are almost certain killer was a player, so we create a message
	if(isPlayer leader(group _killer))then{
		_dyntxt = format["
		<t size='0.75'align='left'shadow='1'color='#5882FA'>%1</t>
		<t size='0.5'align='left'shadow='1'>  Killed  </t>
		<t size='0.75'align='left'shadow='1'color='#c70000'>%2</t><br/>
		<t size='0.45'align='left'shadow='1'> With: </t>
		<t size='0.5'align='left'shadow='1'color='#FFCC00'>%3</t>
		<t size='0.45'align='left'shadow='1'> - Distance: </t>
		<t size='0.5'align='left'shadow='1'color='#FFCC00'>%4m</t><br/>
		<img size='2.5'align='left'shadow='1'image='%5'/>
		",
		_killerName,
		_victimName,
		_txt,
		_distance,
		_pic
		];

		_hint = parseText format ["
			<t size='1.25'align='center'shadow='1'color='#5882FA'>%1</t><br/>
			<t size='1'align='Center'shadow='1'>Killed:</t><br/>
			<t size='1.25'align='Center'shadow='1'color='#c70000'>%2</t><br/>
			<t size='1'align='Center'shadow='1'>With Weapon:</t><br/>
			<img size='5'shadow='1'image='%3'/><br/>
			<t size='1.25'align='Center'shadow='1'>[</t><t size='1.25'align='Center'shadow='1'color='#FFCC00'>%4</t><t size='1.25'align='Center'shadow='1'>]</t><br/>
			<t size='1'align='Center'shadow='1'>Distance:</t><br/>
			<t size='1.25'align='Center'shadow='1'color='#FFCC00'>%5m</t><br/>",
			_killerName,
			_victimName,
			_pic,
			_txt,
			_distance
		];
		_message = format["%1 was killed by %2 with %3 from %4m",_victimName, _killerName, _txt, _distance];
		_loc_message = format["[KillFeed]: PKILL: %1 was killed by %2 with %3 from %4m", _victimName, _killerName, _weapon, _distance];
	}else{
		if(_HALV_KillFeed_AI)then{
			//killer is not a player
			_killerType = typeOf _killer;
			if !((gettext (configFile >> 'CfgVehicles' >> _killerType >> 'displayName')) isEqualTo "")then{
				_killerName = gettext (configFile >> 'CfgVehicles' >> _killerType >> 'displayName');
			};
			if(_killerName isEqualTo "Error: No vehicle")then{
				_nearkillerobjs = nearestObjects [_player,["Epoch_Sapper_F","Epoch_SapperB_F","Epoch_SapperG_F","test_EmptyObjectForFireBig","Bo_Mk82","Rocket_03_HE_F","M_Mo_82mm_AT_LG","Bo_GBU12_LGB","Bo_GBU12_LGB_MI10","HelicopterExploSmall"],10];
				if(count _nearkillerobjs > 0)exitWith{
					_nearestkillerobj = _nearkillerobjs select 0;
					_killerName = gettext (configFile >> 'CfgVehicles' >> (typeOf _nearestkillerobj) >> 'displayName');
					_distance = 0;
					_txt = switch(typeOf _nearestkillerobj)do{
						case "Epoch_Sapper_F":{"Explosion"};
						case "Epoch_SapperB_F":{"Explosion"};
						case "Epoch_SapperG_F":{"Explosion"};
						case "Bo_Mk82":{"Explosion"};
						case "Rocket_03_HE_F":{"Explosion"};
						case "M_Mo_82mm_AT_LG":{"Explosion"};
						case "Bo_GBU12_LGB":{"Explosion"};
						case "Bo_GBU12_LGB_MI10":{"Explosion"};
						case "HelicopterExploSmall":{"Explosion"};
						case "test_EmptyObjectForFireBig":{"Fire"};
						default{"Explosion or Fire"};
					};
				};

//				if(typeName _killer isEqualTo "OBJECT")exitWith{};

			};
			_message = format["%1 was killed by a %2 with %3 from %4m",_victimName,_killerName,_txt,_distance];
			if(_killerName isEqualTo "Error: No vehicle") then {
					_hint = parseText format["<t align='Center'shadow='2'>%1</t>",_message];		
			} else {  // assume the killer was an armed AI
				_hint = parseText format ["
					<t size='1.25'align='center'shadow='1'color='#5882FA'>%1</t><br/>
					<t size='1'align='Center'shadow='1'>Killed:</t><br/>
					<t size='1.25'align='Center'shadow='1'color='#c70000'>%2</t><br/>
					<t size='1'align='Center'shadow='1'>With Weapon:</t><br/>
					<img size='5'shadow='1'image='%3'/><br/>
					<t size='1.25'align='Center'shadow='1'>[</t><t size='1.25'align='Center'shadow='1'color='#FFCC00'>%4</t><t size='1.25'align='Center'shadow='1'>]</t><br/>
					<t size='1'align='Center'shadow='1'>Distance:</t><br/>
					<t size='1.25'align='Center'shadow='1'color='#FFCC00'>%5m</t><br/>",
					_killerName,
					_victimName,
					_pic,
					_txt,
					_distance
				];
			};
			_dyntxt = format["<t size='0.70'align='left'shadow='1'>%1</t>",_message];
			_loc_message = format["[KillFeed]: PKILL: %1 | %2",_message,_killerType];
		};
	};		
}else{
	//if player is killer
	_message = format["%1 died for an unknown reason!",name _player];
	_hint = parseText format["<t align='Center'shadow='2'>%1</t>",_message];
	_dyntxt = format["<t size='0.70'align='left'shadow='1'>%1</t>",_message];
	_loc_message = format["[KillFeed]: PKILL: %1 died for an unknown reason!| '%2' - '%3'", _victimName,_killer,_weapon];
	
	// Check if Zed Killer
	_nearZed = (nearestObjects [(getPos _victim), ["Man"], 50]) select 1; // Will return nearest Man other than player
	if (getText(configFile >> 'CfgVehicles' >> (typeOf _nearZed) >> 'author') isEqualTo 'Ryan') then {
		// Player died to Ryan Zed
		_message = format["%1 was eaten by zombies",_victimName];
		_hint = parseText format["<t align='Center'shadow='2'>%1</t>",_message];
		_dyntxt = format["<t size='0.70'align='left'shadow='1'>%1</t>",_message];
		_loc_message = format["[KillFeed]: PKILL: %1 was eaten by zombies| '%2' - '%3'", _victimName,_killer,_weapon];
	};
};

_player setVariable ["HALV_STUDY",_infostudy, true];

if(_loc_message isEqualTo "")then{_loc_message = format["[KillFeed]: PKILL: %1 was killed by %2 with %3",_player,_killer,_weapon];};

diag_log _loc_message;

if !(_message isEqualTo "")then{
	{
		if(_x select 0) then {
			HalvPV_player_message = (_x select 1);
			publicVariable "HalvPV_player_message";
		};
	}forEach[
		[_HALV_KillFeedhint,["hint", _hint]],[_HALV_KillFeedhintSilent,["hintSilent", _hint]],[_HALV_KillFeedsystemChat,["systemChat", _message]],
		[_HALV_KillFeeddynamictext,["dynamictext", _dyntxt]],[_HALV_KillFeedsideChat,["sideChat", _message, _killer]],
		[_HALV_KillFeedglobalChat,["globalChat", _message, _killer]],[_HALV_KillFeedcutText,["cutText", [_message, "PLAIN DOWN"]]],
		[_HALV_KillFeedtitleText,["titleText", [_message, "PLAIN DOWN"]]]
	];
};

 

Link to comment
Share on other sites

  • 0

In your case the _victim (Player Killed) will not be the _killer (The One who killed the player). Line 144. The if it is in had already checked that the killer was not the player so it's also redundant.

 

Here's how I would try it.

			_loc_message = format["[KillFeed]: PKILL: %1 | %2",_message,_killerType];
			// Ryan Zeds
			if ((gettext (configFile >> 'CfgVehicles' >> _killerType >> 'author')) isEqualTo "Ryan")then{
			{
				_message = format["%1 was eaten by zombies",_victimName];
				_hint = parseText format["<t align='Center'shadow='2'>%1</t>",_message];
				_dyntxt = format["<t size='0.70'align='left'shadow='1'>%1</t>",_message];
				_loc_message = format["[KillFeed]: PKILL: %1 was eaten by zombies| '%2' - '%3'", _victimName,_killer,_weapon];
			};
		};
	};		
}else{

 

You already have the typeOf killer so just see if it is a Ryan zed, if so player was killed by a zed.
No need to get nearEntities as it won't run if the _killer isn't a zed. Also bad code as someone getting shot while standing near a zed might report a zed kill.
I also believe _player is undefined in that if.

 

EDIT: Looking at Ryan's Zeds code if they aren't dealing direct damage they may not come back as the killer. Would need to see what is being returned in the handler to fix that. (if so)

Link to comment
Share on other sites

  • 0

@TheVampire

Thanks for your time and input, unfortunately the code above stop the killfeed from working(no errors in server or client rpt's)

However I did note that 1 x }; was missing from your code, I added it back like below

			_loc_message = format["[KillFeed]: PKILL: %1 | %2",_message,_killerType];
			// Killed by Ryan's Zombie 
			if ((gettext (configFile >> 'CfgVehicles' >> _killerType >> 'author')) isEqualTo "Ryan")then{
				{
				_message = format["%1 was eaten by zombies",_victimName];
				_hint = parseText format["<t align='Center'shadow='2'>%1</t>",_message];
				_dyntxt = format["<t size='0.70'align='left'shadow='1'>%1</t>",_message];
				_loc_message = format["[KillFeed]: PKILL: %1 was eaten by zombies| '%2' - '%3'", _victimName,_killer,_weapon];
				};
			};
		};
	};		
}else{

with the bracket and semicolon in-place the killfeed would work as expected thou the killed by ryan's zombie didn't work just rolled through to  "player died for an unknown reason!"

I'll keep trying thanks again.

cheers

natoed

Link to comment
Share on other sites

  • 0

I have a feeling that the Killer is null with zeds. They used to use setDamage and now use setHit on the Body.

Can you uncomment this line and give me the details of what it logs?

//diag_log format["[KillFeed] halv_fnc_playerdied.sqf server function triggered for player %1 and killer %2",_player,_killer];

 

Link to comment
Share on other sites

  • 0

halv_fnc_playerdied.sqf  - unedited with line 13 uncomment

server rpt

10:37:26 "[KillFeed] halv_fnc_playerdied.sqf server function triggered for player B Alpha 1-1:1 (DRINK natoed) REMOTE and killer B Alpha 1-1:1 (DRINK natoed) REMOTE"
10:37:26 "[KillFeed]: PKILL: DRINK natoed died for an unknown reason! | 'B Alpha 1-1:1 (DRINK natoed) REMOTE' - 'Rollins_F'"

 

client rpt

10:37:26 Performance warning: SimpleSerialization::Read 'HalvPV_player_message' is using type of ,'TEXT' which is not optimized by simple serialization, falling back to generic serialization, use generic type or ask for optimizations for these types
10:37:26 "Half_fnc_message_players.sqf  _sender B Alpha 1-1:1 (DRINK natoed) | _type hint | _message DRINK natoed died for an unknown reason!"
10:37:26 Performance warning: SimpleSerialization::Read 'HalvPV_player_message' is using type of ,'TEXT' which is not optimized by simple serialization, falling back to generic serialization, use generic type or ask for optimizations for these types
10:37:26 "Half_fnc_message_players.sqf  _sender B Alpha 1-1:1 (DRINK natoed) | _type hintSilent | _message DRINK natoed died for an unknown reason!"

 

Link to comment
Share on other sites

  • 0

I should have you another script by the time you're on tomorrow.

The code you had to check for zeds should be decent but it needs to go elsewhere.

The area your code needs to be is after the section by the //if player is killer area. Check for a near zed using nearObjects "Man" select 1, check if that's a zed, if so died to zeds. Cant type it up on mobile.

Link to comment
Share on other sites

  • 0

thx Vamp

It errors out tho and killfeed rolls thought to player died for an unknown reason!

10:46:45 Error in expression <timName,_killer,_weapon];


_nearZed = (nearestObjects [(getPos _victim), ["Man">
10:46:45   Error position: <nearestObjects [(getPos _victim), ["Man">
10:46:45   Error 0 elements provided, 3 expected
10:46:45 File mpmissions\__cur_mp.Altis\2dmin\addons\messages\halv_fnc_playerdied.sqf, line 149
10:46:45 "[KillFeed]: PKILL: DRINK natoed died for an unknown reason!| 'B Alpha 1-1:1 (DRINK natoed) REMOTE' - ''"

I don't want take up anymore of your time Vamp and thank you for your help. (looking forward to the new VEMF btw)

I will come back to it at later point  when I have learnt more.

So for a quick work-around  yes its piss weak and lame but it will do for now  I'll edit the following

}else{
	//if player is killer
	_message = format["%1 died for an unknown reason!",name _player];
	_hint = parseText format["<t align='Center'shadow='2'>%1</t>",_message];
	_dyntxt = format["<t size='0.70'align='left'shadow='1'>%1</t>",_message];
	_loc_message = format["[KillFeed]: PKILL: %1 died for an unknown reason!| '%2' - '%3'", _victimName,_killer,_weapon];

to this

}else{
	//if player is killer
	_message = format["%1 died for an unknown reason!<br/>Maybe a Zombie...",name _player];
	_hint = parseText format["<t align='Center'shadow='2'>%1</t>",_message];
	_dyntxt = format["<t size='0.70'align='left'shadow='1'>%1</t>",_message];
	_loc_message = format["[KillFeed]: PKILL: %1 died for an unknown reason!<br/>Maybe a Zombie...| '%2' - '%3'", _victimName,_killer,_weapon];

many thanks

natoed

Link to comment
Share on other sites

  • 0
1 hour ago, TheVampire said:

Change


(getPos _victim)

To


(getPos _player)

(_victim must be null)

On the money Vamp and thank you again

for anybody else wanting killed by zombies with Halvhjearne's Killfeed

halv_fnc_playerdied.sqf  dont forget the thank @TheVampire

 

Spoiler

/*
	a3 epoch killfeed server function
	By Halv
	
	Copyright (C) 2015  Halvhjearne > README.md
*/
#include "settings.sqf";

private ["_weapon","_player","_killer","_distance","_victimName","_killerName","_txt","_pic","_vehicleKillerType","_nearZed","_victim"];

_player = _this select 1 select 0;
_killer = _this select 1 select 1;
//diag_log format["[KillFeed] halv_fnc_playerdied.sqf server function triggered for player %1 and killer %2",_player,_killer];

_player setVariable ["bodyUID", getPlayerUID _player, true];

_message = "";
_dyntxt = "";
_loc_message = "";
_hint = "";

_killerName = name _killer;
_victimName = name _player;

_distance = _player distance _killer;

_weapon = currentWeapon _killer;

_infostudy = [_killerName,_victimName,serverTime];

if (!(_killer isEqualTo _player) && !((vehicle _killer) isEqualTo (vehicle _player)))then{
	//if killer is not vehicle
	_txt = (gettext (configFile >> 'cfgWeapons' >> _weapon >> 'displayName'));
	_pic = (gettext (configFile >> 'cfgWeapons' >> _weapon >> 'picture'));
	_vehicleKillerType = typeOf(vehicle _killer);

	//if killer is a vehicle type, then we get vehicle picture
	{
		if(_vehicleKillerType isKindOf _x)exitWith{
			_pic = (gettext (configFile >> 'CfgVehicles' >> _vehicleKillerType >> 'picture'));
			//and if he was in a driver position of the vehicle, we get vehicle displayName aswell
			if(_killer isEqualTo (driver(vehicle _killer)))then{
				_txt = (gettext (configFile >> 'CfgVehicles' >> _vehicleKillerType >> 'displayName'));
			};
		};
	}count ["LandVehicle","Air","Ship"];

	//if weapon is a horn classname, then the killer was also driver, so we get vehicle displayName instead of weapon displayName
	if(_weapon in ["Horn","MiniCarHorn","SportCarHorn","TruckHorn2","TruckHorn","BikeHorn","CarHorn","TruckHorn3"])then{
		_txt = (gettext (configFile >> 'CfgVehicles' >> _vehicleKillerType >> 'displayName'));
	};
	_infostudy pushBack _pic;
	_infostudy pushBack _txt;
	//if leader of killer group was a player, then we are almost certain killer was a player, so we create a message
	if(isPlayer leader(group _killer))then{
		_dyntxt = format["
		<t size='0.75'align='left'shadow='1'color='#5882FA'>%1</t>
		<t size='0.5'align='left'shadow='1'>  Killed  </t>
		<t size='0.75'align='left'shadow='1'color='#c70000'>%2</t><br/>
		<t size='0.45'align='left'shadow='1'> With: </t>
		<t size='0.5'align='left'shadow='1'color='#FFCC00'>%3</t>
		<t size='0.45'align='left'shadow='1'> - Distance: </t>
		<t size='0.5'align='left'shadow='1'color='#FFCC00'>%4m</t><br/>
		<img size='2.5'align='left'shadow='1'image='%5'/>
		",
		_killerName,
		_victimName,
		_txt,
		_distance,
		_pic
		];

		_hint = parseText format ["
			<t size='1.25'align='center'shadow='1'color='#5882FA'>%1</t><br/>
			<t size='1'align='Center'shadow='1'>Killed:</t><br/>
			<t size='1.25'align='Center'shadow='1'color='#c70000'>%2</t><br/>
			<t size='1'align='Center'shadow='1'>With Weapon:</t><br/>
			<img size='5'shadow='1'image='%3'/><br/>
			<t size='1.25'align='Center'shadow='1'>[</t><t size='1.25'align='Center'shadow='1'color='#FFCC00'>%4</t><t size='1.25'align='Center'shadow='1'>]</t><br/>
			<t size='1'align='Center'shadow='1'>Distance:</t><br/>
			<t size='1.25'align='Center'shadow='1'color='#FFCC00'>%5m</t><br/>",
			_killerName,
			_victimName,
			_pic,
			_txt,
			_distance
		];
		_message = format["%1 was killed by %2 with %3 from %4m",_victimName, _killerName, _txt, _distance];
		_loc_message = format["[KillFeed]: PKILL: %1 was killed by %2 with %3 from %4m", _victimName, _killerName, _weapon, _distance];
	}else{
		if(_HALV_KillFeed_AI)then{
			//killer is not a player
			_killerType = typeOf _killer;
			if !((gettext (configFile >> 'CfgVehicles' >> _killerType >> 'displayName')) isEqualTo "")then{
				_killerName = gettext (configFile >> 'CfgVehicles' >> _killerType >> 'displayName');
			};
			if(_killerName isEqualTo "Error: No vehicle")then{
				_nearkillerobjs = nearestObjects [_player,["Epoch_Sapper_F","Epoch_SapperB_F","Epoch_SapperG_F","test_EmptyObjectForFireBig","Bo_GBU12_LGB"],10];
				if(count _nearkillerobjs > 0)exitWith{
					_nearestkillerobj = _nearkillerobjs select 0;
					_killerName = gettext (configFile >> 'CfgVehicles' >> (typeOf _nearestkillerobj) >> 'displayName');
					_distance = 0;
					_txt = switch(typeOf _nearestkillerobj)do{
						case "Epoch_Sapper_F":{"Explosion"};
						case "Epoch_SapperB_F":{"Explosion"};
						case "Epoch_SapperG_F":{"Explosion"};
						case "Bo_GBU12_LGB":{"Explosion"};
						case "test_EmptyObjectForFireBig":{"Fire"};
						default{"Explosion or Fire"};
					};
				};

//				if(typeName _killer isEqualTo "OBJECT")exitWith{};

			};
			_message = format["%1 was killed by a %2 with %3 from %4m",_victimName,_killerName,_txt,_distance];
			if(_killerName isEqualTo "Error: No vehicle") then {
					_hint = parseText format["<t align='Center'shadow='2'>%1</t>",_message];		
			} else {  // assume the killer was an armed AI
				_hint = parseText format ["
					<t size='1.25'align='center'shadow='1'color='#5882FA'>%1</t><br/>
					<t size='1'align='Center'shadow='1'>Killed:</t><br/>
					<t size='1.25'align='Center'shadow='1'color='#c70000'>%2</t><br/>
					<t size='1'align='Center'shadow='1'>With Weapon:</t><br/>
					<img size='5'shadow='1'image='%3'/><br/>
					<t size='1.25'align='Center'shadow='1'>[</t><t size='1.25'align='Center'shadow='1'color='#FFCC00'>%4</t><t size='1.25'align='Center'shadow='1'>]</t><br/>
					<t size='1'align='Center'shadow='1'>Distance:</t><br/>
					<t size='1.25'align='Center'shadow='1'color='#FFCC00'>%5m</t><br/>",
					_killerName,
					_victimName,
					_pic,
					_txt,
					_distance
				];
			};
			_dyntxt = format["<t size='0.70'align='left'shadow='1'>%1</t>",_message];
			_loc_message = format["[KillFeed]: PKILL: %1 | %2",_message,_killerType];
		};
	};		
}else{
	//if player is killer
	_message = format["%1 died for an unknown reason!",name _player];
	_hint = parseText format["<t align='Center'shadow='2'>%1</t>",_message];
	_dyntxt = format["<t size='0.70'align='left'shadow='1'>%1</t>",_message];
	_loc_message = format["[KillFeed]: PKILL: %1 died for an unknown reason!| '%2' - '%3'", _victimName,_killer,_weapon];
	
	// Check if Zed Killer
	_nearZed = (nearestObjects [(getPos _player), ["Man"], 50]) select 1; // Will return nearest Man other than player
	if (getText(configFile >> 'CfgVehicles' >> (typeOf _nearZed) >> 'author') isEqualTo 'Ryan') then {
		// Player died to Ryan Zed
		_message = format["%1 was eaten by zombies",_victimName];
		_hint = parseText format["<t align='Center'shadow='2'>%1</t>",_message];
		_dyntxt = format["<t size='0.70'align='left'shadow='1'>%1</t>",_message];
		_loc_message = format["[KillFeed]: PKILL: %1 was eaten by zombies| '%2' - '%3'", _victimName,_killer,_weapon];
	};
};

_player setVariable ["HALV_STUDY",_infostudy, true];

if(_loc_message isEqualTo "")then{_loc_message = format["[KillFeed]: PKILL: %1 was killed by %2 with %3",_player,_killer,_weapon];};

diag_log _loc_message;

if !(_message isEqualTo "")then{
	{
		if(_x select 0) then {
			HalvPV_player_message = (_x select 1);
			publicVariable "HalvPV_player_message";
		};
	}forEach[
		[_HALV_KillFeedhint,["hint", _hint]],[_HALV_KillFeedhintSilent,["hintSilent", _hint]],[_HALV_KillFeedsystemChat,["systemChat", _message]],
		[_HALV_KillFeeddynamictext,["dynamictext", _dyntxt]],[_HALV_KillFeedsideChat,["sideChat", _message, _killer]],
		[_HALV_KillFeedglobalChat,["globalChat", _message, _killer]],[_HALV_KillFeedcutText,["cutText", [_message, "PLAIN DOWN"]]],
		[_HALV_KillFeedtitleText,["titleText", [_message, "PLAIN DOWN"]]]
	];
};

 

 

big smile on my face

cheers

natoed

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Discord

×
×
  • Create New...