Jump to content
Sign in to follow this  
zuff

Duplicate addactions using BIS_fnc_MP as listen server with other players

Recommended Posts

I'm working on a fairly big project which I hope to release soon to the public, but i'm having a few snags with Addactions and BIS_fnc_mp as the host of a listen server.

I have a base setup with a map board that has an addaction on it for selecting a mission. Here's how it looks:

init.sqf

[] execVM "scripts\addActions.sqf";

addActions.sqf

[[mapBoard,"<t color=""#C4EAFF"">" + "Select Mission Type","scripts\missionSelect.sqf","missionSelect",10], "fnc_addactionMP", true, false] spawn BIS_fnc_MP;

functions.sqf

fnc_addactionMP = {
private["_object","_screenMsg","_scriptToCall","_arguments","_priority"];
_object = _this select 0;
_screenMsg = _this select 1;
_scriptToCall = _this select 2;
_arguments = _this select 3;
_priority = _this select 4;

if(isNull _object) exitWith {};

_object addaction [_screenMsg,_scriptToCall,_arguments,_priority];
};

When another player is in game on the map board I get two "Select Mission Type" addactions. How can I prevent this from happening? I figure it's happening because the code is running on all machines from bis_fnc_mp and so I'm seeing the code run on the other players machine plus my own.

It works great for all players except if I'm hosting a listen server. I'd like this mission to be compatible with SP/MP/Dedicated so It's something I'd like to figure out now. I figured some isServer checks would fix but I really haven't yet grasped locality and multiplayer issues at their fullest.

Thanks in advance!

Share this post


Link to post
Share on other sites

addActions.sqf runs on every machine ?

---------- Post added at 10:57 AM ---------- Previous post was at 10:56 AM ----------

Oh you already knew that.

Add an isServer check or just add the action without bis fnc mp

Share this post


Link to post
Share on other sites
addActions.sqf runs on every machine ?

---------- Post added at 10:57 AM ---------- Previous post was at 10:56 AM ----------

Oh you already knew that.

Add an isServer check or just add the action without bis fnc mp

Ended up using the editor to place triggers and addactions. Saved me a lot of headaches.

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  

×