Jump to content
Sign in to follow this  
1para{god-father}

EventHandler Need some help

Recommended Posts

Where am i going wrong ?

I am trying to add in " this execvm 'Respawn.sqf';" if i take it out it works but cannot work out how to add this into the below ?


xhandle = this addEventHandler ["killed", this execvm 'Respawn.sqf';{ if (_this select 1 == player) then {totalscore = totalscore + 50;  publicVariable  "totalscore";}}]

Share this post


Link to post
Share on other sites

It needs to be inside the curly brackets and you probably want to have "_this" instead of "this"

Share this post


Link to post
Share on other sites

Thanks , Now have another issue !

Any idea why this will not work , I need to Add side in as well as i have some Playable OPFOR and do not want to add the score if they kill other OPFOR or kill themselves

Working

xhandle = this addMPEventHandler ["MPKilled", { if (_this select 1 == player) then {totalscore = totalscore + 5;  publicVariable "totalscore";}}];

Not working when i try and Add the Side in ?

xhandle = this addMPEventHandler ["MPKilled", { if (_this select 1 == player and side == WEST ) then {totalscore = totalscore + 5;  publicVariable "totalscore";}}];

Share this post


Link to post
Share on other sites

Hi,

You should use isPlayer instead.

Side function expects an Object as parameter.

xhandle = this addMPEventHandler ["MPKilled", { if (isPlayer (_this select 1) AND side (_this select 1) == WEST ) then {totalscore = totalscore + 5;  publicVariable "totalscore";}}];

Why use an MP variant of the eventhandler anyway? Since you publicVariable the totalscore...

Share this post


Link to post
Share on other sites

Yes, the score will be increased by 5 times the number of clients and another 5 if you're on a dedicated server.

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  

×