Broadcast automatic messages

Broadcast automatic messages

« posted: May 17, 2015, 03:11 PM »
Anyone know how this can be done on a rented server. BTW BEC can't be used on our server.

Re: Broadcast automatic messages

« Reply #1 posted: May 17, 2015, 05:20 PM »
In your config.cfg there is a place for repeating messages.

Code: [Select]
motd[] = {
"STRING",
"STRING",
"STRING",
"STRING",
"STRING",
"STRING"
};
motdInterval = 240;

  • Offline bolox
  • Mercenary
  • *****
  • Posts: 276

Re: Broadcast automatic messages

« Reply #2 posted: May 17, 2015, 07:02 PM »
Create an SQF file and name it  client_announceMessages.sqf
Drop that into the root in arma

Where it says message 1 message 2 etc,add your messages there.You can change the timings of message to when you want it to pop up.(SECONDS)



Code: [Select]
//***************************************************************
//***************************************************************
//Coded by calibaan www.nomercykillers.com

//***************************************************************
//***************************************************************
private ["_MessagesToAnnounceStringArray","_DisplayTimesCheckArray","_MinimumSleepTimeScalar","_DisplayReadyMessageStringsArray","_MiniumTimeBetweenAnnouncementsScalar","_CurrentAnnouncementTimeCounterScalar","_UpdatedAnnouncementTimeScalar","_CompiledMessageDisplayString"];

/*
The message announcement array has the following format: [Message to display, format String, Time between announcements, format scalar]
For example:
["Testmessage1 here!", 60], ["This is testmessage 2 displayed every 90 seconds!", 90]
*/

_MessagesToAnnounceStringArray = [["messsage 1", 750], ["messsage 2", 1270], 
["messsage 3", 900], ["messsage 4", 1360], ["messsage 5", 1450]];
if ((count _MessagesToAnnounceStringArray) == 0) exitWith
{
diag_log format ["** Automatic message announcement not used, the array is empty. **"];
};

if (isNil ("CGV_MessageAnnouncementArray")) then
{
CGV_MessageAnnouncementArray = [];
};

_DisplayTimesCheckArray = [];
{
CGV_MessageAnnouncementArray set [count CGV_MessageAnnouncementArray, [_x select 0, _x select 1, 0]];
_DisplayTimesCheckArray set [count _DisplayTimesCheckArray, _x select 1];
} forEach _MessagesToAnnounceStringArray;

_MinimumSleepTimeScalar = [_DisplayTimesCheckArray, 0] call BIS_fnc_findExtreme;
if (_MinimumSleepTimeScalar > 300) then
{
_MinimumSleepTimeScalar = 300;
};
_MinimumSleepTimeScalar = 5;

while {(true)} do
{
_DisplayReadyMessageStringsArray = [];

{
_DisplayMessageString = _x select 0;
_MiniumTimeBetweenAnnouncementsScalar = _x select 1;
_CurrentAnnouncementTimeCounterScalar = _x select 2;

if (_CurrentAnnouncementTimeCounterScalar >= _MiniumTimeBetweenAnnouncementsScalar) then
{
_DisplayReadyMessageStringsArray set [count _DisplayReadyMessageStringsArray, _DisplayMessageString];
_UpdatedAnnouncementTimeScalar = 0;
}
else
{
_UpdatedAnnouncementTimeScalar = _CurrentAnnouncementTimeCounterScalar + _MinimumSleepTimeScalar;
};

[CGV_MessageAnnouncementArray, [_forEachIndex, 2], _UpdatedAnnouncementTimeScalar] call BIS_fnc_setNestedElement;
} forEach CGV_MessageAnnouncementArray;

if ((count _DisplayReadyMessageStringsArray) != 0) then
{
_CompiledMessageDisplayString = "";

{
_CompiledMessageDisplayString = _CompiledMessageDisplayString + _x;
} forEach _DisplayReadyMessageStringsArray;

cutText [_CompiledMessageDisplayString, "PLAIN DOWN", 2, false];
};

sleep _MinimumSleepTimeScalar;
};


In your main init.sqf add this code at the bottom

init,sqf

Code: [Select]
if (!(isServer)) then
{
ClientPreComp_AnnounceMessages = compileFinal preprocessFileLineNumbers "client_AnnounceMessages.sqf";

[] call ClientPreComp_AnnounceMessages;
};

This will display timed messages at the bottom middle of the screen
Our 250 popular player rust server 1rule- Dont be a dick
www.nomercykillers.com
  • Offline CREAMPIE
  • Armaholic
  • Veteran
  • ******
  • Posts: 1077
  • ^_^;;

Re: Broadcast automatic messages

« Reply #3 posted: May 18, 2015, 07:51 AM »
I might try this out too - since I host some servers on Gameservers ( The WORST ) -

Now all I'd need is to announce restarts and somehow get an auto restart :P


- from the grassy knoll -

Re: Broadcast automatic messages

« Reply #4 posted: May 18, 2015, 08:00 AM »
thanks for this gonna do a test drive on it

Re: Broadcast automatic messages

« Reply #5 posted: May 18, 2015, 08:00 AM »
Will also test it out! Cream when u manage to get autorestarts work without BEC then please let me know. I host on PurePings and they don't allow BEC. Iv been looking for a months now and no hope..
  • Offline CREAMPIE
  • Armaholic
  • Veteran
  • ******
  • Posts: 1077
  • ^_^;;

Re: Broadcast automatic messages

« Reply #6 posted: May 18, 2015, 08:48 AM »
Will also test it out! Cream when u manage to get autorestarts work without BEC then please let me know. I host on PurePings and they don't allow BEC. Iv been looking for a months now and no hope..

I saw a provider that had BEC built into their hosting - I would move in a heartbeat but have alot of credit sitting in Gameservers at the moment :(

Go have a look at Nitrado - you can schedule BEC stuff throught their web interface and have access to alot more stuff ...

- from the grassy knoll -

Re: Broadcast automatic messages

« Reply #7 posted: May 18, 2015, 06:03 PM »
In your config.cfg there is a place for repeating messages.

Code: [Select]
motd[] = {
"STRING",
"STRING",
"STRING",
"STRING",
"STRING",
"STRING"
};
motdInterval = 240;


It doesn't loop it though

Re: Broadcast automatic messages

« Reply #8 posted: May 18, 2015, 10:53 PM »
Create an SQF file and name it  client_announceMessages.sqf
Drop that into the root in arma

Where it says message 1 message 2 etc,add your messages there.You can change the timings of message to when you want it to pop up.(SECONDS)



Code: [Select]
//***************************************************************
//***************************************************************
//Coded by calibaan www.nomercykillers.com

//***************************************************************
//***************************************************************
private ["_MessagesToAnnounceStringArray","_DisplayTimesCheckArray","_MinimumSleepTimeScalar","_DisplayReadyMessageStringsArray","_MiniumTimeBetweenAnnouncementsScalar","_CurrentAnnouncementTimeCounterScalar","_UpdatedAnnouncementTimeScalar","_CompiledMessageDisplayString"];

/*
The message announcement array has the following format: [Message to display, format String, Time between announcements, format scalar]
For example:
["Testmessage1 here!", 60], ["This is testmessage 2 displayed every 90 seconds!", 90]
*/

_MessagesToAnnounceStringArray = [["messsage 1", 750], ["messsage 2", 1270], 
["messsage 3", 900], ["messsage 4", 1360], ["messsage 5", 1450]];
if ((count _MessagesToAnnounceStringArray) == 0) exitWith
{
diag_log format ["** Automatic message announcement not used, the array is empty. **"];
};

if (isNil ("CGV_MessageAnnouncementArray")) then
{
CGV_MessageAnnouncementArray = [];
};

_DisplayTimesCheckArray = [];
{
CGV_MessageAnnouncementArray set [count CGV_MessageAnnouncementArray, [_x select 0, _x select 1, 0]];
_DisplayTimesCheckArray set [count _DisplayTimesCheckArray, _x select 1];
} forEach _MessagesToAnnounceStringArray;

_MinimumSleepTimeScalar = [_DisplayTimesCheckArray, 0] call BIS_fnc_findExtreme;
if (_MinimumSleepTimeScalar > 300) then
{
_MinimumSleepTimeScalar = 300;
};
_MinimumSleepTimeScalar = 5;

while {(true)} do
{
_DisplayReadyMessageStringsArray = [];

{
_DisplayMessageString = _x select 0;
_MiniumTimeBetweenAnnouncementsScalar = _x select 1;
_CurrentAnnouncementTimeCounterScalar = _x select 2;

if (_CurrentAnnouncementTimeCounterScalar >= _MiniumTimeBetweenAnnouncementsScalar) then
{
_DisplayReadyMessageStringsArray set [count _DisplayReadyMessageStringsArray, _DisplayMessageString];
_UpdatedAnnouncementTimeScalar = 0;
}
else
{
_UpdatedAnnouncementTimeScalar = _CurrentAnnouncementTimeCounterScalar + _MinimumSleepTimeScalar;
};

[CGV_MessageAnnouncementArray, [_forEachIndex, 2], _UpdatedAnnouncementTimeScalar] call BIS_fnc_setNestedElement;
} forEach CGV_MessageAnnouncementArray;

if ((count _DisplayReadyMessageStringsArray) != 0) then
{
_CompiledMessageDisplayString = "";

{
_CompiledMessageDisplayString = _CompiledMessageDisplayString + _x;
} forEach _DisplayReadyMessageStringsArray;

cutText [_CompiledMessageDisplayString, "PLAIN DOWN", 2, false];
};

sleep _MinimumSleepTimeScalar;
};


In your main init.sqf add this code at the bottom

init,sqf

Code: [Select]
if (!(isServer)) then
{
ClientPreComp_AnnounceMessages = compileFinal preprocessFileLineNumbers "client_AnnounceMessages.sqf";

[] call ClientPreComp_AnnounceMessages;
};

This will display timed messages at the bottom middle of the screen

It's not coming up for me. Am i doing it correctly?

My client_announceMessages.sqf

Code: [Select]
//***************************************************************
//***************************************************************
//Coded by calibaan www.nomercykillers.com

//***************************************************************
//***************************************************************
private ["_MessagesToAnnounceStringArray","_DisplayTimesCheckArray","_MinimumSleepTimeScalar","_DisplayReadyMessageStringsArray","_MiniumTimeBetweenAnnouncementsScalar","_CurrentAnnouncementTimeCounterScalar","_UpdatedAnnouncementTimeScalar","_CompiledMessageDisplayString"];

/*
The message announcement array has the following format: [Message to display, format String, Time between announcements, format scalar]
For example:
["Testmessage1 here!", 60], ["This is testmessage 2 displayed every 90 seconds!", 90]
*/

_MessagesToAnnounceStringArray = [["Join our free TeamSpeak - Blackshotgaming.teamspeak.net", 50], ["Visit our website - Blackshotgaming.enjin.com", 50], 
["Base saving lasts for 7 days", 100], ["Server restarts are at 12:00 & 00:00 ", 70], ["SERVER RESTART IN 5 MINUTES!", 42900], ["SERVER RESTART IN 1 MINUTE! SAVE YOUR GEAR!", 43140]];
if ((count _MessagesToAnnounceStringArray) == 0) exitWith
{
diag_log format ["** Automatic message announcement not used, the array is empty. **"];
};

if (isNil ("CGV_MessageAnnouncementArray")) then
{
CGV_MessageAnnouncementArray = [];
};

_DisplayTimesCheckArray = [];
{
CGV_MessageAnnouncementArray set [count CGV_MessageAnnouncementArray, [_x select 0, _x select 1, 0]];
_DisplayTimesCheckArray set [count _DisplayTimesCheckArray, _x select 1];
} forEach _MessagesToAnnounceStringArray;

_MinimumSleepTimeScalar = [_DisplayTimesCheckArray, 0] call BIS_fnc_findExtreme;
if (_MinimumSleepTimeScalar > 300) then
{
_MinimumSleepTimeScalar = 300;
};
_MinimumSleepTimeScalar = 5;

while {(true)} do
{
_DisplayReadyMessageStringsArray = [];

{
_DisplayMessageString = _x select 0;
_MiniumTimeBetweenAnnouncementsScalar = _x select 1;
_CurrentAnnouncementTimeCounterScalar = _x select 2;

if (_CurrentAnnouncementTimeCounterScalar >= _MiniumTimeBetweenAnnouncementsScalar) then
{
_DisplayReadyMessageStringsArray set [count _DisplayReadyMessageStringsArray, _DisplayMessageString];
_UpdatedAnnouncementTimeScalar = 0;
}
else
{
_UpdatedAnnouncementTimeScalar = _CurrentAnnouncementTimeCounterScalar + _MinimumSleepTimeScalar;
};

[CGV_MessageAnnouncementArray, [_forEachIndex, 2], _UpdatedAnnouncementTimeScalar] call BIS_fnc_setNestedElement;
} forEach CGV_MessageAnnouncementArray;

if ((count _DisplayReadyMessageStringsArray) != 0) then
{
_CompiledMessageDisplayString = "";

{
_CompiledMessageDisplayString = _CompiledMessageDisplayString + _x;
} forEach _DisplayReadyMessageStringsArray;

cutText [_CompiledMessageDisplayString, "PLAIN DOWN", 2, false];
};

sleep _MinimumSleepTimeScalar;
};

My init.sqf

Code: [Select]
// ******************************************************************************************
// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com *
// ******************************************************************************************
// @file Version: 1.2
// @file Name: init.sqf
// @file Author: [404] Deadbeat, [GoT] JoSchaap, AgentRev
// @file Description: The main init.

#define DEBUG false

enableSaving [false, false];

_descExtPath = str missionConfigFile;
currMissionDir = compileFinal str (_descExtPath select [0, count _descExtPath - 15]);

X_Server = false;
X_Client = false;
X_JIP = false;

// versionName = ""; // Set in STR_WL_WelcomeToWasteland in stringtable.xml

if (isServer) then { X_Server = true };
if (!isDedicated) then { X_Client = true };
if (isNull player) then { X_JIP = true };

A3W_scriptThreads = [];

[DEBUG] call compile preprocessFileLineNumbers "globalCompile.sqf";

//init Wasteland Core
[] execVM "config.sqf";
[] execVM "storeConfig.sqf"; // Separated as its now v large
[] execVM "briefing.sqf";

if (!isDedicated) then
{
[] spawn
{
if (hasInterface) then // Normal player
{
9999 cutText ["Welcome to Blackshot Gaming, please wait for your client to initialize", "BLACK", 0.01];

waitUntil {!isNull player};
player setVariable ["playerSpawning", true, true];

removeAllWeapons player;
client_initEH = player addEventHandler ["Respawn", { removeAllWeapons (_this select 0) }];

// Reset group & side
[player] joinSilent createGroup playerSide;

execVM "client\init.sqf";
}
else // Headless
{
waitUntil {!isNull player};
if (typeOf player == "HeadlessClient_F") then
{
execVM "client\headless\init.sqf";
};
};
};
};

if (isServer) then
{
diag_log format ["############################# %1 #############################", missionName];
diag_log "WASTELAND SERVER - Initializing Server";
[] execVM "server\init.sqf";
};

//init 3rd Party Scripts
[] execVM "addons\R3F_ARTY_AND_LOG\init.sqf";
[] execVM "addons\proving_ground\init.sqf";
[] execVM "addons\scripts\DynamicWeatherEffects.sqf";
[] execVM "addons\JumpMF\init.sqf";
[] execVM "addons\vactions\functions.sqf"; // Micovery vehicle actions
if(hasInterface) then{[] execVM "addons\statusBar\statusbar.sqf"};
if (!(isServer)) then
{
ClientPreComp_AnnounceMessages = compileFinal preprocessFileLineNumbers "client_AnnounceMessages.sqf";

[] call ClientPreComp_AnnounceMessages;
};
playMusic "intro";


  • Offline CREAMPIE
  • Armaholic
  • Veteran
  • ******
  • Posts: 1077
  • ^_^;;

Re: Broadcast automatic messages

« Reply #9 posted: May 19, 2015, 08:07 AM »
works great! thanks xD

Remember to add the compile path for your file if you didn't put it in the root of your mission file.

Here's my Init.sqf

Code: [Select]
//Client Announcements
if (!(isServer)) then
{
ClientPreComp_AnnounceMessages = compileFinal preprocessFileLineNumbers "addons\announceMessages\client_AnnounceMessages.sqf";

[] call ClientPreComp_AnnounceMessages;
};

- from the grassy knoll -

Re: Broadcast automatic messages

« Reply #10 posted: May 19, 2015, 11:54 AM »
works great! thanks xD

Remember to add the compile path for your file if you didn't put it in the root of your mission file.

Here's my Init.sqf

Code: [Select]
//Client Announcements
if (!(isServer)) then
{
ClientPreComp_AnnounceMessages = compileFinal preprocessFileLineNumbers "addons\announceMessages\client_AnnounceMessages.sqf";

[] call ClientPreComp_AnnounceMessages;
};


Done it. I've got questions though:

Do you know how i can move the text to show in the corner of the screen?
How do you change how long the message lasts for?
Can i change the colour of the text for certain messages?
How can i change it so the messages start when the server starts and not when the player spawns in?
My custom text merges with the arma 3 wasteland text, is there a fix for this?

Re: Broadcast automatic messages

« Reply #11 posted: May 19, 2015, 01:18 PM »
Create an SQF file and name it  client_announceMessages.sqf
Drop that into the root in arma

Where it says message 1 message 2 etc,add your messages there.You can change the timings of message to when you want it to pop up.(SECONDS)



Code: [Select]
//***************************************************************
//***************************************************************
//Coded by calibaan www.nomercykillers.com

//***************************************************************
//***************************************************************
private ["_MessagesToAnnounceStringArray","_DisplayTimesCheckArray","_MinimumSleepTimeScalar","_DisplayReadyMessageStringsArray","_MiniumTimeBetweenAnnouncementsScalar","_CurrentAnnouncementTimeCounterScalar","_UpdatedAnnouncementTimeScalar","_CompiledMessageDisplayString"];

/*
The message announcement array has the following format: [Message to display, format String, Time between announcements, format scalar]
For example:
["Testmessage1 here!", 60], ["This is testmessage 2 displayed every 90 seconds!", 90]
*/

_MessagesToAnnounceStringArray = [["messsage 1", 750], ["messsage 2", 1270], 
["messsage 3", 900], ["messsage 4", 1360], ["messsage 5", 1450]];
if ((count _MessagesToAnnounceStringArray) == 0) exitWith
{
diag_log format ["** Automatic message announcement not used, the array is empty. **"];
};

if (isNil ("CGV_MessageAnnouncementArray")) then
{
CGV_MessageAnnouncementArray = [];
};

_DisplayTimesCheckArray = [];
{
CGV_MessageAnnouncementArray set [count CGV_MessageAnnouncementArray, [_x select 0, _x select 1, 0]];
_DisplayTimesCheckArray set [count _DisplayTimesCheckArray, _x select 1];
} forEach _MessagesToAnnounceStringArray;

_MinimumSleepTimeScalar = [_DisplayTimesCheckArray, 0] call BIS_fnc_findExtreme;
if (_MinimumSleepTimeScalar > 300) then
{
_MinimumSleepTimeScalar = 300;
};
_MinimumSleepTimeScalar = 5;

while {(true)} do
{
_DisplayReadyMessageStringsArray = [];

{
_DisplayMessageString = _x select 0;
_MiniumTimeBetweenAnnouncementsScalar = _x select 1;
_CurrentAnnouncementTimeCounterScalar = _x select 2;

if (_CurrentAnnouncementTimeCounterScalar >= _MiniumTimeBetweenAnnouncementsScalar) then
{
_DisplayReadyMessageStringsArray set [count _DisplayReadyMessageStringsArray, _DisplayMessageString];
_UpdatedAnnouncementTimeScalar = 0;
}
else
{
_UpdatedAnnouncementTimeScalar = _CurrentAnnouncementTimeCounterScalar + _MinimumSleepTimeScalar;
};

[CGV_MessageAnnouncementArray, [_forEachIndex, 2], _UpdatedAnnouncementTimeScalar] call BIS_fnc_setNestedElement;
} forEach CGV_MessageAnnouncementArray;

if ((count _DisplayReadyMessageStringsArray) != 0) then
{
_CompiledMessageDisplayString = "";

{
_CompiledMessageDisplayString = _CompiledMessageDisplayString + _x;
} forEach _DisplayReadyMessageStringsArray;

cutText [_CompiledMessageDisplayString, "PLAIN DOWN", 2, false];
};

sleep _MinimumSleepTimeScalar;
};


In your main init.sqf add this code at the bottom

init,sqf

Code: [Select]
if (!(isServer)) then
{
ClientPreComp_AnnounceMessages = compileFinal preprocessFileLineNumbers "client_AnnounceMessages.sqf";

[] call ClientPreComp_AnnounceMessages;
};

This will display timed messages at the bottom middle of the screen

Done it. I've got questions though:

Do you know how i can move the text to show in the corner of the screen?
How do you change how long the message lasts for?
Can i change the colour of the text for certain messages?
How can i change it so the messages start when the server starts and not when the player spawns in?
My custom text merges with the arma 3 wasteland text, is there a fix for this?

Re: Broadcast automatic messages

« Reply #12 posted: May 19, 2015, 06:25 PM »
i would love to have this triggered when the server starts to instead of player joining.

i cant install bec on my server and with a thing of this triggered when the server starts it would be possible to set up restart messages near the restart hours
  • Offline bolox
  • Mercenary
  • *****
  • Posts: 276

Re: Broadcast automatic messages

« Reply #13 posted: May 19, 2015, 07:26 PM »
You can also set this to print messages via the radio in the corner of the screen,will post a tut on that when i get home.
Our 250 popular player rust server 1rule- Dont be a dick
www.nomercykillers.com

Re: Broadcast automatic messages

« Reply #14 posted: May 19, 2015, 07:27 PM »
You can also set this to print messages via the radio in the corner of the screen,will post a tut on that when i get home.

I would very much prefer this. Thanks!