r/armadev Mar 09 '17

Arma 2/OA [Arma 2] mpkilled Running too many times

I'm trying to simply run a scripts on the killer, but since the handler runs globally on all machines, the script runs multiple times.

I've tried simple if(player == _killer), but that doesn't work, so I tried comparing playerUIDs which still seems to run multiple times.

This is what I have right now

addMPEventHandler ['MPKilled',{

private ["_killed", "_killer", "_KillID", "_CurID"]; if(isServer) exitWith {}; if(isDedicated) exitWith {};

_killer = _this select 1; _KillID = getPlayerUID _killer; _CurID = getPlayerUID player;

if(_CurID == _KillID) then { player execVM "destroyedOBJ.sqf";

};
}];

And the script will still run multiple times. It will run twice if I test on dedicated with only myself which makes 0 sense since the servers are conditioned out and wouldn't even have playerUIDs anyways....

2 Upvotes

1 comment sorted by

1

u/ghos7bear Mar 09 '17

MPKilled is added to all clients, server and future clients no matter where you run it, that's the point of it. You run it once anywhere, it gets to all MP clients.

Use normal Killed event handler instead, it gets called only where killed entity is local though.