[HELP] Custom Local_EventKill with HintSilent

UrbanSkaters

Valued Member!
I've got a custom Local_EventKill.sqf that gives the player a bonus of 15 humanity if they hit a zed at 150+ meters. That part of the script works great, but I also have a hintsilent that popups with a message that includes distance, bonus etc..

Problem is, if another player is close by they might receive the message for your kill, not the humanity,just the message. It is pretty random, it happens every few time out of 5 or so. I even got a "NICE SHOT" hint message after a heli crashed nearby killing a zed. I'm not sure why this is happening.. Here's the script (note, I've cut down the hintsilent to keep this short)....

Code:
//[unit, selectionName, damage, source, projectile]
//will only run when local to the created object
//record any key hits to the required selection
private ["_distance","_zed","_killer","_kills","_array","_type","_humanity"];

_array = 		_this select 0;
_zed = 			_array select 0;
_killer = 		_array select 1;
_type = 		_this select 1;
_distance =		_killer distance _zed;

if (local _zed) then {
	_kills = _killer getVariable[_type,0];
	_killer setVariable[_type,(_kills + 1),true];
	_humanity = _killer getVariable["humanity",0];
		
	if(_distance > 150) then 
	{_humanity = _humanity + 15;
		hintSilent "Nice Shot!";
	} else {
	_humanity = _humanity + 5};
	
	_killer setVariable["humanity",_humanity,true];
};

Just to clarify. When a player gets a zed kill, the humanity is added and the players zed kill count goes up. But on random occasions, players who didn't get the kill, will receive the hintsilent message...
 
Its very simple. The zed isn't local on the player that killed him. It is local on the player where the message showed up.

You are going to have to bounce the message to the server and back to the killer.
 
Its very simple. The zed isn't local on the player that killed him. It is local on the player where the message showed up.

You are going to have to bounce the message to the server and back to the killer.

That sounds like hacker talk to me :)

But seriously, would you have any suggestions for doing that? Thanks for the reply btw.
 
You could try to insert something like a hack but that would be weird.

Look up publick variables. KillZoneKid has some good tutorials on it.

Basically you would send one ot the server. On the server, you would send one to the owner computer of the killer and your done. Here is a good setup you can leverage that is doing a different task. In this particular setup you would need to pass the message instead of rating and then instead of setting rating, you would use your msg print there.



// Setup Rating
CD_SetRating = {
private ["_unit","_rating"];
_unit = _this select 0;
_rating = _this select 1;
if (local _unit) then {
_unit addRating _rating;
} else {
CD_Rating = _this;
if (isDedicated) then {
(owner _unit) publicVariableClient "CD_Rating";
} else {
publicVariableServer "CD_Rating";
};
};
};
"CD_Rating" addPublicVariableEventHandler {
(_this select 1) call CD_SetRating;
};
 
Yeah, I tried the public variable route a while back . But it kicks up a fuss with battleye. I'll checkout the killzonekid stuff you mention. Thanks for the code to work with too :D

Cheers :D
 
Last edited:
fix your battle eye filters then.

I didn't give you a way to do this. I gave you the only way to do it.
 
Back
Top