skimmer8824 1 Posted March 20, 2013 Hi, I have been trying to get this simple piece of code to work. It is properly executed in SP and on a listen server; however, it fails to work on a dedicated server. The code gives the player an action to print "Hello" to all clients. What have I overlooked? Thanks! init.sqf: // init.sqf waituntil {!(isnil "bis_fnc_init")}; showChat true; enableSaving [False, False]; gc_function = {(_this select 0) globalchat (_this select 1)}; sayHello = FALSE; publicVariable "sayHello"; if(!isDedicated) then { player addAction ["Say Hello","talk.sqf"]; }; if (isServer) then { while {true} do { waitUntil {sayHello}; [[player, "Hello"], "gc_function"] call BIS_fnc_mp; sayHello = FALSE; publicVariable "sayHello"; }; }; talk.sqf: sayHello = TRUE; publicVariable "sayHello"; Share this post Link to post Share on other sites
BlenderRUS 6 Posted March 20, 2013 use addPublicVariableEventHandler instead of non-sleep cycle. i.e.: // init.sqf waituntil {!(isnil "bis_fnc_init")}; showChat true; enableSaving [False, False]; gc_function = {(_this select 0) globalchat (_this select 1)}; if(!isDedicated) then { player addAction ["Say Hello","talk.sqf"]; }; if (isServer) then { "sayHello" addPublicVariableEventHandler { if (_this select 1) then { [[player, "Hello"], "gc_function"] call BIS_fnc_mp; sayHello = false; }; }; }; talk.sqf: sayHello = true; publicVariableServer "sayHello"; Share this post Link to post Share on other sites
skimmer8824 1 Posted March 20, 2013 (edited) Thanks for the quick reply. This works in a listen server environment, but I still can't get it to work on a dedicated server. The RPT file contains repeated entries of "Handler not present". Edited March 20, 2013 by skimmer8824 Share this post Link to post Share on other sites
skimmer8824 1 Posted March 21, 2013 Any ideas?, I can post the PBO if needed. Share this post Link to post Share on other sites