Jump to content
Sign in to follow this  
James Grimm

Why dosent _caller work in MP?

Recommended Posts

I have simply added a sign with

addAction....

 

and that activates this code 

_caller = _this select 1;

_caller addScore 10;

 

This works for me in-game i get my score added but does not work for my friends that joined the game. is there a alternative that works for MP`?

Share this post


Link to post
Share on other sites

addAction code is run on the computer that triggers the action (the player's computer).

addScore only gives score to people when run on the (dedicated) server.

 

You will need to send the addScore command to be executed on the server. This can be done using remoteExecCall:

_caller = _this select 1;
_score = 10;
[_caller,_score] remoteExecCall ["addScore",2];

Where the "2" is the id of the server which is always 2.

  • Like 1

Share this post


Link to post
Share on other sites

Whilst you're at it @Sgt. Dennenboom ;) any idea why this is not working?

_tele = _this select 0;
_caller = _this select 1;


Cash = score _caller;

if (Cash > 99) then {                                                                                                        //line 20
_caller addScore -100;
Offroad setPos (getpos (OffroadStart));
_caller moveingunner Offroad;

_i = 35;

while (_i>1) do {
hint format[_i];                                                                                                         //Not working
sleep 1;
_i = _i-1;
};

sleep 35;

Offroad setPos (getpos (OffroadEnd));
Offroad setVehicleAmmo 1;
Offroad setDamage 0;
_caller setPos (getpos (OffroadEnd2));
} else {
hint format["You dont have enough cash. You have %1",cash];
};

In game, i get an error that says http://prntscr.com/hw2g3w (Line 20 has been marked by a comment )

But why does all code below the while statement refuse to run and I don't get the timer I've made.

And yes I know I need to change _caller addScore -100; from here as well.

Share this post


Link to post
Share on other sites

Easy mistake:


while { _i > 1 } do { ...... };

{ vs (

Nobody said SQF was consistent :)

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  

×