Jump to content
Sign in to follow this  
Beerkan

addaction in multiplayer

Recommended Posts

I'm not sure if this is a SP or MP issue.

Basically I want each player in MP to be only to run this action once.

in the init of the unit I have

player addaction ["Spawn Quad Bike","scripts\spawn_quad.sqf"];

spawn_quad.sqf

private ["_unit", "_quad"];
_unit = this select 0;
_quad ="B_Quadbike_F" createVehicle (position _unit);
_unit removeAction 0;

The above doesn't work. I does if I substitute "_unit" with "player". But I need it to run separately for each player in MP. Do I need the variables to be private? If so, how do I ensure the script only runs for the player that called it?

Share this post


Link to post
Share on other sites
I'm not sure if this is a SP or MP issue.

Basically I want each player in MP to be only to run this action once.

in the init of the unit I have

player addaction ["Spawn Quad Bike","scripts\spawn_quad.sqf"];

spawn_quad.sqf

private ["_unit", "_quad"];
_unit = this select 0;
_quad ="B_Quadbike_F" createVehicle (position _unit);
_unit removeAction 0;

The above doesn't work. I does if I substitute "_unit" with "player". But I need it to run separately for each player in MP. Do I need the variables to be private? If so, how do I ensure the script only runs for the player that called it?

_this

Share this post


Link to post
Share on other sites

unfortunately you need to use the new BIS_fnc_mp to execute the function on each client - by function you will have to make an addaction function.

Share this post


Link to post
Share on other sites
unfortunately you need to use the new BIS_fnc_mp to execute the function on each client - by function you will have to make an addaction function.

He doesn't need fnc_mp, he's not running it as an event, it's just a thing everyone has, so the init.sqf is fine.

Share this post


Link to post
Share on other sites

At the top of your spawn_squad.sqf:

private ["_unit", "_id", "_quad"];
_unit = _this select 1;
_id = _this select 2;
_unit removeAction _id;
_quad ="B_Quadbike_F" createVehicle (position _unit);

Share this post


Link to post
Share on other sites

My bad didnt read the player bit lol. Sorry thought u were attaching it to a game object

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  

×