Distance Killed Displayed to All

Nebulazer

Valued Member!
I found this code in an armaholic thread for showing kill distance

Code:
this addEventHandler ["killed", {hint format["%1 killed by %2 %3",_this select 1, _this select 0, _this select 1 distance _this select 0]}]

How can I apply this to my server. Is there something i would need to put before it for it to apply to all players? Would i put it in my Init or would I make a new script for it and call it from my Init?
 
Just put it in your init under an if (!isDedicated) then {
This way it will only run for players (not dedicated).

Cool find, let us know if it works!
maybe I'll look into adding it to my new zed code so zombies show kill distance too?
 
Awesome, I am trying this out, ill let you know how it go's. Thanks for the help. Do you know anything about adding a save function to R3F Logistics? I have been trying to figure out where i would need to add the line of code in the mission file to allow the objects to save their new locations.
 
You mean for like tow/lift? Mine works fine...?

I remember hearing that you had to get in the vehicle and drive it a few feet after moving it. Not sure.
There used to be a vehicle/tent save function that would just write all the object info to the sql database - but that was a little while ago.. Maybe you could find that and add it to the vehicles?
 
Just put it in your init under an if (!isDedicated) then {
This way it will only run for players (not dedicated).

Cool find, let us know if it works!
maybe I'll look into adding it to my new zed code so zombies show kill distance too?

I put this with the existing if (!isDedicated) then {

and it did not work. Do i need to create a new one, or should that have worked?
 
Well, the 'this' in the script needs to point to something. I'm guessing it doesn't. Where you found it, how do they call it?

Maybe replace them with player - but I'm not sure how you'd differentiate the players. Read up about adding event handlers too.
 
http://www.armaholic.com/forums.php?m=posts&q=755

That is the thread i found it in originally.

Should work... Altho that would mean that you have to add that to every enemy's/units init unless you use the foreach command and exec it from the init.sqs (can't help ya here cuz I don't know how to do it myself :) .)
So you're going to have to add it to every unit's init field - figure out where the eventhandlers are added to the player and just drop yours in there. probably in dayz_server but I'm not sure.
 
This should display the the distance of a kill.
Code:
killMsg = format[playerKilled: %1 was killed by %2 from %3m", _victimName, _killerName, _distance];

think that code goes in the server_playerDied. Could be wrong but ill double check when i can get on the server.
 
Back
Top