Jump to content
Sign in to follow this  
Socrate

EventHandler Locality of script esecuted

Recommended Posts

Ok sorry for the stupid question :

suppose i initialize this in the init.sqf:

if(isPlayer) then {
   player addEventHandler ["killed", "hint format['Killed by %1',_this select 1]"];
};

Because the init.sqf is run on all computer an event handler is setted for each player.

Looking at the sintax of the addEventHandler:

Number = object addEventHandler [type, command]

My question is: is the command statment executed on all computer or only on the one that triggered the event?

thank you

Share this post


Link to post
Share on other sites

You actually want to put this in the other scripting forum (bottom of Editing).

isPlayer needs to be applied to an object and there's no need for the built-in reference to player (which will always point to a player except on a dedicated server). I think you want;

if (!(isNull player)) then {

player addEventHandler ["killed", "hint format['Killed by %1', _this select 1]"];

};

The hint will be executed only on the computer of the player who died.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×