Jump to content
pierremgi

What kind of server I'm playing on?

Recommended Posts

Hi everyone,

My 2 cent question:

I'd like to define in a script, what kind of server I'm playing on. The aim is to make a versatile addon disabling capabilities when gaming on public servers but with better latitude when the mission is hosted (LAN, or even SP).

So far, i can't use isServer, isDedicated... just because the client returns always false (except for the hosting PC but it's a particular case).

 

I tried:

 {missionNamespace setVariable ["dedicated",isdedicated];
  publicVariable "dedicated"} remoteExec ["call",2];

but it seems uncertain with some public servers.

Any idea to have this data by a more accurate way?

Thanks

Share this post


Link to post
Share on other sites

Thanks but initServer.sqf runs... on server. And I'm not on server but on a client PC. That's the reason why I remote exec this variable to the server and wait for a feedback as publicVariable. That works! The challenge now is to catch the info thru the publicVariable, each time. Some servers are returning "any", then "true" after a passage into the lobby for choosing another unit.

Furthermore, I'd rather use a BI function for that, if any, instead of declaring something remotely on a public server. It's not a big string but If this could be avoided...

Share this post


Link to post
Share on other sites
// initServer.sqf
missionNamespace setVariable ['isDedicated',isDedicated,TRUE];

I'd avoid using reserved words as variable names. Madness lies within.

Share this post


Link to post
Share on other sites

Thanks but initServer.sqf runs... on server. And I'm not on server but on a client PC. That's the reason why I remote exec this variable to the server and wait for a feedback as publicVariable. That works! The challenge now is to catch the info thru the publicVariable, each time. Some servers are returning "any", then "true" after a passage into the lobby for choosing another unit.

Furthermore, I'd rather use a BI function for that, if any, instead of declaring something remotely on a public server. It's not a big string but If this could be avoided...

 

ahh i see, for addon compatibility

// -- on client
 
if (!isMultiplayer) exitWith {missionNamespace setVariable ['tag_var_isDedicated',FALSE,FALSE];};
if (!isNil {missionNamespace getVariable 'tag_var_isDedicated'}) exitWith {comment 'variable exists, use the value';};
[[],{missionNamespace setVariable ['tag_var_isDedicated',isDedicated,TRUE];}] remoteExec ['BIS_fnc_call',2,FALSE];
_t = time + 10;
waitUntil {
     (!isNil {missionNamespace getVariable 'tag_var_isDedicated'}) ||
     (time > _t)
};
if (time > _t) exitWith {missionNamespace setVariable ['tag_var_isDedicated',FALSE,FALSE];};
if (isNil {missionNamespace getVariable 'tag_var_isDedicated'}) exitWith {missionNamespace setVariable ['tag_var_isDedicated',FALSE,FALSE];};
comment 'your variable exists';
 

maybe isdedicated command should be extended to support query from client machine as well.

 

The only issue is if the server doesn't whitelist your function/command for remote execution. If a server is using the RE whitelist, they will most likely not whitelist call, but in most cases they have to whitelist BIS_fnc_call in order to use the vanilla debug console, so less likely to be blocked.

 

There doesn't appear to be a native way to derive server type from the client

Share this post


Link to post
Share on other sites

Thank you mdcclxxvi . Yes, it seems there is no other solution other than ask the server to send a variable.

I'm about to release this addon, and i know some servers have B.E. filter which will kick the players with this addon.

So, I hope to satisfy SP, MP hosted and servers without such filter or servers enabling my addon with signature (MGI Tactical Pack V3).

 

I managed tools such icons or Halo jump, prisoners, sticking charges... along with contexts like MP/SP, hosted / dedi,  difficulty also.

Some stuffs are easy: you can teleport the player on SP, not on MP. But you can HALO jump on MP if a certain object is named on your map. It's a mission owner's choice.

Others are more difficult: making prisoner is hard to define: set with difficulty +    hosted "yes" / dedi "no"    context in MP.

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

×