Jump to content
Sign in to follow this  
florianmuellerch

Set Killed event handler in initPlayerLocal.sqf

Recommended Posts

Hi guys

When I try to set up the killed event handler to my joining player in initPlayerLocal.sqf, it won't work.

player addEventHandler ["killed",{_this call PEG_fnc_playerKilled}];

This function is a function which gets compiled before on the dedicated server.

I tried:

- "this" instead of "player"

- "[_this] call ..." instead of "_this call..."

Please help! :(

Share this post


Link to post
Share on other sites

I made this mistake as well:

_index = player addMPEventHandler ["mpkilled", {hint format['Killed by %1',_this select 1];}];

Share this post


Link to post
Share on other sites
I made this mistake as well:

_index = player addMPEventHandler ["mpkilled", {hint format['Killed by %1',_this select 1];}];

I tried the MP event before, but I've constructed now another solution which uses the regular events ("killed"/"respawn").

But my mistake was that the function PEG_fnc_playerKilled was compiled before in initServer.sqf, but this seems not to be visible in initPlayerLocal.sqf - neither would it make sense because I'm using iniDB on the server in there ;)

But thanks for your help!

Share this post


Link to post
Share on other sites

Yes it may be best to compile the Arma3 way:

https://community.bistudio.com/wiki/Functions_Library_(Arma_3)#Adding_a_Function

Main benefits uncludes:

Automatic compilation upon mission start into a global variable - no need to remember direct paths to files.

Anti-hack protection using compileFinal

Listing in the Functions Viewer

Advanced debugging options

Optional immediate execution upon mission start, without need for manual call

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  

×