Forum Jump :

Author Message


Mc Script

Posts: 1034

Level: Member

Country: ch
Location: St. Gallen
Occupation: Armaholic addon tester
Age: 50
In-game name: Myke

#35848 Posted at 2008-10-09 19:08        
addPublicVariableEventHandler might do the trick. First, edit your existing script:

if ((_killer != _victim) && (isPlayer _killer) && (vehicle _killer == _killer)) then
   this_is_teamkiller = _killer;
   publicVariable "this_is_teamkiller";
   hq globalchat format["%1 received -5 points for teamkill",name _killer];

Then, in your init.sqf/sqs, add this:
this_is_teamkiller = objnull;
"this_is_teamkiller" addPublicVariableEventHandler {nul = this execVM "is_it_teamkiller.sqf"};

And finally you need a new script, the "is_it_teamkiller.sqf"
_killer = _this select 1;
if (_killer == local player) then {
   player addscore -5;

This is untested and out of the blue. I hope it does the job.