Forum Jump :

Author Message

piXel  



Posts: 67
Rank:


Level: Member

Country: nl
Location:
Occupation:
Age:
In-game name:

 
#35850 Posted at 2008-10-09 20:42        
     
Thx Myke. A very inspiring answer I'll test it and post the result.

It worked! With the following three scripts:
plrinit.sqf (is activated with a is: "local player" trigger; when a player joins the game)
death.sqf (is activated by the eventHandler "killed" )
teamkiller.sqf (is activated by the "teamkiller" PublicVariableEventHandler)

plrinit.sqf
nul = _player addEventHandler ["killed", {nul = [_this select 0, _this select 1] execVM "team_scripts\death.sqf"}];
"teamkiller" addPublicVariableEventHandler {nul = [_this select 1] execVM "team_scripts\teamkiller.sqf"};

death.sqf
_victim = _this select 0;
_killer = _this select 1;

//teamkill
if ((_killer != _victim) && (isPlayer _killer) && (vehicle _killer == _killer)) then
{
teamkiller = _killer;
publicVariable "teamkiller";
hq globalchat format["%1 received punishment for teamkilling",name _killer];
};

//removebody
sleep 120;
hidebody _victim;
sleep 4;
deletevehicle _victim;

teamkiller.sqf
_player = player;
_fool = _this select 0;

hq globalchat format["Don't shoot teammembers %1 !!",name _fool];

if (_fool == _player) then 
{
_player addscore -4;
};

cheers .

This post was edited by piXel (2008-10-10 22:15, ago)