Jump to content
Sign in to follow this  
Naiss

isServer

Recommended Posts

im trying to do something server sided but it wont work i only get the false messages, when i test on my own pc and just host one it works just fine but on a dedic box it wont work

if (IsServer) then {
hint "IsServer TRUE";
} else {
hint "IsServer FALSE";
};

if (isDedicated) then {
systemChat "isDedicated TRUE";
} else {
systemChat "isDedicated FALSE";
};

Share this post


Link to post
Share on other sites

How do you know it's not working on the server? It's displaying the messages on the server, not on your client.

Share this post


Link to post
Share on other sites

because i tryed to activate a function on isServer on my pc and that works but not on the dedic box

Share this post


Link to post
Share on other sites
lol..

instead of 'lol'ing, why don't you contribute something to the discussion? or just don't comment.

@lifemanalive - What shuko is saying, is that systemChat (wiki) will not return anything you could see if run on dedicated - no screen for dedicated, so neither systemChat nor Hint will show. To test effects, you could use diag_log to print your message to the RPT file, to verify its working

edit: ^^what kk said. ninja'd

Edited by dr_strangepete
late to the party

Share this post


Link to post
Share on other sites
if (IsServer) then
{
["isServer TRUE", "systemChat", true] call BIS_fnc_MP;
} else
{
["isServer FALSE", "systemChat", true] call BIS_fnc_MP;
};

if (isDedicated) then
{
["isDedicated TRUE", "systemChat", true] call BIS_fnc_MP;
} else
{
["isDedicated FALSE", "systemChat", true] call BIS_fnc_MP;
};

Share this post


Link to post
Share on other sites

thanks alot i understand now how it works XD i feel so stupid right now :P

Share this post


Link to post
Share on other sites

Should i start putting "&& isServer" in all my triggers? because i have been noticing that some of the triggers in my mission that have been activated wont show the text effect on the screen?

Share this post


Link to post
Share on other sites
Should i start putting "&& isServer" in all my triggers? because i have been noticing that some of the triggers in my mission that have been activated wont show the text effect on the screen?

That wouldn't make a difference at all, triggers are locally (clientside) activated, so all the effects are local to the player who activated it (unless the command used says otherwise), but what this thread is pointing out is that executing a text display command (i.e. hint) on the server is redundant, as no one will see it on a dedicated box, it has to be globalized via something like BIS_fnc_MP for it to display to everyone, servers don't have monitors that everyone looks at :p. (I could be in part wrong with this, a little tired atm :))

Share this post


Link to post
Share on other sites
/* Dedicated Server: */

isServer     //true
isDedicated  //true
hasInterface //false

/* Player-hosted Server: */

isServer     //true
isDedicated  //false
hasInterface //true

/* Normal Client: */

isServer     //false
isDedicated  //false
hasInterface //true

/* Headless Client: */

//not really sure if headless can be server
hasInterface //false

Share this post


Link to post
Share on other sites
That wouldn't make a difference at all, triggers are locally (clientside) activated, so all the effects are local to the player who activated it (unless the command used says otherwise), but what this thread is pointing out is that executing a text display command (i.e. hint) on the server is redundant, as no one will see it on a dedicated box, it has to be globalized via something like BIS_fnc_MP for it to display to everyone, servers don't have monitors that everyone looks at :p. (I could be in part wrong with this, a little tired atm :))

Ahh thank you for explaining Jshock ;)

Share this post


Link to post
Share on other sites
/* Dedicated Server: */

isServer     //true
isDedicated  //true
hasInterface //false

/* Player-hosted Server: */

isServer     //true
isDedicated  //false
hasInterface //true

/* Normal Client: */

isServer     //false
isDedicated  //false
hasInterface //true

/* Headless Client: */

//not really sure if headless can be server
hasInterface //false

/* Headless Client: */

isServer //false

isDedicated //false

hasInterface //false

Share this post


Link to post
Share on other sites

i got another stupid question here, im trying to load a server sided function from the server ofc to the client so let's say they join the server then we got a code thats like: if (isServer) then { [] call Server_fnc_test; }; how would i make that function call back to the player?

Load:

if (isServer) then {
[] call Server_fnc_test; //i do understand that this is only going to be runned for the server but how is the setup for the server to run it then the server to run it to the client
};

Server_fnc_test:

Server_fnc_test = {
createDialog "Test";
systemChat "test123";	
};

Share this post


Link to post
Share on other sites

okey so i tested the bis_fnc_mp and here is what i tryed but it wont work, if anyone should help me out with this one :P

Start:


if (isServer) then {
[] call compile PreprocessFileLineNumbers "\RPP_Core\init.sqf";
};

when the server loads the init on the server side it will have this line of code in it so it will load for all players but i just can't get it to return back to the player,

init:

["\RPP_Core\init.sqf","BIS_fnc_execVM",true,true] call BIS_fnc_MP; 

Share this post


Link to post
Share on other sites

May be because you aren't providing all the parameters to BIS_fnc_execVM:

[[[any script parameters],"\RPP_Core\init.sqf"],"BIS_fnc_execVM",true,false,false] call BIS_fnc_MP;

And, do not use the persistence parameter for BIS_fnc_MP, which is the fourth parameter, which you have set to true, set that to false, which I have done for you.

Share this post


Link to post
Share on other sites

okey so i have tryed everything now and i can get it to load to the server side but if i try to load it on my pc it works but when i try to load it to the server side it just wont work, this is what i tryed just to check if it loads:

init.sqf

enableSaving [false,false];

if(isServer) then { 
   [] execVM "\RPP_Core\init.sqf"; 
};

Server side, init:

[["Hello World"],"BIS_fnc_guiMessage",nil,true] spawn BIS_fnc_MP;

but if i try to debug ingame like this it works just fine:

if (isServer) then {
[["Hello World"],"BIS_fnc_guiMessage",nil,true] spawn BIS_fnc_MP;
};

is there a problem with the way im trying to call the server side init.sqf file or

Share this post


Link to post
Share on other sites

If you want this on the server, where you have nil replace it with false, if you want this executed on both the server and the clients, keep the if (isServer) check and replace that false/nil with true (at least I think that would work...).

Share this post


Link to post
Share on other sites

okey that worked just fine :D now i just need to know one more thing XD i really do appreciate your help just want you to know that.

okey so let's say the player load in it will load that server sided function and give you that msg just for a test then it's going to load another function thats called test_fnc, im not 100% sure how i would do that but i tryed something and failed xD

client side init (first init):

if(isServer) then { 
   [] execVM "\RPP_Core\init.sqf"; 
};

Server side init:

if (isServer) then {
[] execVM "\RPP_Core\Functions\fn_RPP_test.sqf"; //Not sure if im going to set it up like this if i want it to load for the server and also for the client because of the calling part
sleep 0.1;
[["Server side :D"],"BIS_fnc_guiMessage",true,true] spawn BIS_fnc_MP; //i do get this msg
[[], "Test_fnc", true, true] spawn BIS_fnc_MP; //this is where im not sure how i would do and make it call to the player
};

fn_RPP_Test.sqf:

Test_fnc = {
systemchat "Hello, 123";	
};

and i dont want the whole server to call test_fnc only the player that just joined and started to loadin

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  

×