Jump to content
unidad2pete

Hint server to all players?

Recommended Posts

Hello;

*** I have a problem with the hint.

I have a variable for each team. This variable adds points to the team with an area under control. With the command "if (! IsServer) exitWith {}," I get to be the server that is responsible for doing the work. My problem is that when you display a hint with the points of each team, the message is not shown to players on a dedicated server.

Init.sqf:

if (! IsServer) exitWith {};
_null = [] execVM "loopcontrol.sqf";
scorewest = 0;
scoreeast = 0;
scoreguer = 0;

loopcontrol.sqf:

While {true} do
{

if (MY CONDITION) then {scorewest = scorewest +1;};

if (MY CONDITION2) then {scoreeast = scoreeast +1;};

if (MY CONDITION3) then {scoreguer = scoreguer +1;};

scorewest _scorew = str;
scoreeast _scoree = str;
scoreguer _scoreg = str;
_scorewp = "BLUFOR =" + _scorew;
_scoreep = "OPFOR =" + _scoree;
_scoregp = "INDEPENDENT =" + _scoreg;
_text = composeText [_scorewp, lineBreak, _scoreep, lineBreak, _scoregp];
hint _text;
sleep 5;
};

By this, I display a constantly hint showing points each team that count the server.

But it only works on a local server. In multiplayer does not display the message.

You can you help me with my problem? I do not know if I and explained well, sorry for my English.

Share this post


Link to post
Share on other sites

You can use the BIS_fnc_MP function.

Define a new function to all players, for example, in init.sqf:

new_fnc_MPhint = { hint _this };

Then you can replace your "hint _text;" with calling this new function through BIS_fnc_MP, so it gets executed on all clients:

[_text, "new_fnc_MPHint"] call BIS_fnc_mp;

  • Thanks 1

Share this post


Link to post
Share on other sites

As Magroit explains above for BIS_fnc_MP.

To help clean your text formating up a bit

While {true} do
{

if (MY CONDITION) then {scorewest = scorewest +1;};

if (MY CONDITION2) then {scoreeast = scoreeast +1;};

if (MY CONDITION3) then {scoreguer = scoreguer +1;};

_text = format["BLUFOR = %1\nOPFOR = %2\nINDEPENDANT = %3",scorewest, scoreeast, scoreguer];

[_text, "new_fnc_MPhint", true, false] spawn BIS_fnc_MP;
sleep 5;
};

Edited by Larrow

Share this post


Link to post
Share on other sites
With the command "if (! IsServer) exitWith {}," I get to be the server that is responsible for doing the work.

this is one of the BIGGEST mistakes u can do........

https://community.bistudio.com/wiki/exitWith

THIS COMMAND DOESNT DO WHAT U THINK !!!!

this function can be used only to exit FROM LOOP

_someArray = [0,0,0,0,0,0,0];

{
 if (_x == 1) exitWith
 {
   _index = _forEachIndex;
   _value = _x;
 };
}
forEach someArray;

this is the only right way how to use this command...

to achieve what u want..

if isDedicated then
{
 // only dedicated
};

if !isDedicated then
{
 // live server
 // clients

 if !isServer then
 {
   // only clients
 };
};

if isServer then
{
 // dedicated server
 // live server
};

brackets re not needed for booleans............................................

DO NOT COPY NOOBS........................

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

×