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)....
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...
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...