Jump to content
Sign in to follow this  
1para{god-father}

repeat message evey hour on dedi

Recommended Posts

I need to have a message displayed to all players every 30min or hour just to let them know some Rules.

What is the Best way to do this ?

Thanks

Share this post


Link to post
Share on other sites

I recommend FSM as apposed to sqf for something that will be running the entirety of the mission. I would execute the FSM for clients only i.e. if (!isDedicated) then {[] execFSM "".fsm} since time sync is not important and you probably want every player to get the message upon joining. If You don't know/are not familiar with FSM then just copy and past the below code and be done with it.

if (isDedicated) exitWith {};
WaitUntil{!isNull player};
sleep 10;

While {true} do {
player sidechat "MY MESSAGE";
sleep (60*60);
};

Share this post


Link to post
Share on other sites
if (isServer) then
{
private["_center","_group","_logic"];
_center = createCenter sideLogic;
_group = createGroup _center;
_logic = _group createUnit ["LOGIC", [0, 0, 0] , [], 0, ""];
_logic setVehicleInit "ServerMsg_Logic = this; this setVehicleVarName ""ServerMsg_Logic"";";
processInitCommands;
};

if (isNil "ServerMessage") then
{
ServerMessage = "";
publicVariable "ServerMessage";
};

"ServerMessage" addPublicVariableEventHandler
{
ServerMsg_Logic globalChat (_this select 1);
};

if (isServer) then
{
while {true} do
{
	sleep 1800; //Hour = 3600
	ServerMessage = "Some message here";
	publicVariable "ServerMessage";
};
};

Share this post


Link to post
Share on other sites

Head over to the server admin forum or head to ibattle.org and set up BEC on your server, which will do what you require without scripting and lots more besides..

Share this post


Link to post
Share on other sites

Just responding with a scripting answer as we're in the "Mission Editing and Scripting" section :)

Yeah, BEC is a good alternative, although the code I sent is not performance heavy at all, it doesn't require you to do any scripting.

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  

×