So here's another think that I found not to be working on my Taviana server, Database loop messaging. I had a play around and found that this works, now as I've been writing (just come back to the top to say) this I've just noticed that it's on dayz.st after skimming it, it's mostly the same but I thought I'd write one anyway from my files as I got the info from a different source (forgot where just comparing old files with the new ones)
Anyway here's how I did it. You'll just need to edit three files server_cleanup, server_monitor in the server.pbo and the init in the mission
We'll start with Init.
You need to comment out the enable radio false line in the init so find
and change it to
and that's it for the init.sqf
next is the server_cleanup
Find this part
Where now going to stick some code in the middle of it so
right after this line
put this code
now right after that we need to change this line
to this
so if right the whole thing should look like this
ok now that's done we need to go down near the bottom of the file and find this bit of code
And as before we're going to put some code in the midde so
right after this line
put this
so if we've done it right it should look like this
Ok that's that for the server_cleanup
Now for the server_monitor.sqf
find this bit of code
Once again putting some code in the middle
So after this line
put this
The whole thing should look like this, note that I've got some "\\Send the key" comments in but probably don't need it as they're only comments
And that's it! Put the files back in the server.pbo and upload
To make a message in the database
Open the MESSAGES table
Click INSERT tab at top
ID - This is sequential, start with the number 1
PAYLOAD - the actual message you want displayed
LOOP_INTERVAL - how many SECONDS before this message displays again
START_DELAY - how many SECONDS before this message starts the first display
INSTANCE_ID - select your instance ID, do NOT leave it null
Again don't take credit for this as I got it somewhere else that I can't remember.
Anyway here's how I did it. You'll just need to edit three files server_cleanup, server_monitor in the server.pbo and the init in the mission
We'll start with Init.
You need to comment out the enable radio false line in the init so find
Code:
enableRadio false;
and change it to
Code:
//enableRadio false;
and that's it for the init.sqf
next is the server_cleanup
Find this part
Code:
/*%FSM</STATE>*/
/*%FSM<STATE "waiting">*/
class waiting
{
name = "waiting";
init = /*%FSM<STATEINIT""">*/"//diag_log ""CLEANUP: Waiting for next task"";" \n
""/*%FSM</STATEINIT""">*/;
Where now going to stick some code in the middle of it so
right after this line
Code:
init = /*%FSM<STATEINIT""">*/"//diag_log ""CLEANUP: Waiting for next task"";" \n
put this code
Code:
"private [""_payload"", ""_interval"",""_delay""];" \n
"{" \n
" _payload = _x select 0;" \n
" _interval = _x select 1;" \n
" _delay = _x select 2;" \n
" if (time - _delay > _interval && _interval != -1) then {" \n
" [nil, nil, rSPAWN, [_crier, _payload], { (_this select 0) globalChat (_this select 1) }] call RE;" \n
" if (_interval == 0) then {" \n
" _msgList set [_forEachIndex, [_payload, -1, time]];" \n
" } else {" \n
" _msgList set [_forEachIndex, [_payload, _interval, time]];" \n
" };" \n
" };" \n
Code:
""/*%FSM</STATEINIT""">*/;
Code:
"} forEach _msgList;"/*%FSM</STATEINIT""">*/;
so if right the whole thing should look like this
Code:
/*%FSM</STATE>*/
/*%FSM<STATE "waiting">*/
class waiting
{
name = "waiting";
init = /*%FSM<STATEINIT""">*/"//diag_log ""CLEANUP: Waiting for next task"";" \n
"private [""_payload"", ""_interval"",""_delay""];" \n
"{" \n
" _payload = _x select 0;" \n
" _interval = _x select 1;" \n
" _delay = _x select 2;" \n
" if (time - _delay > _interval && _interval != -1) then {" \n
" [nil, nil, rSPAWN, [_crier, _payload], { (_this select 0) globalChat (_this select 1) }] call RE;" \n
" if (_interval == 0) then {" \n
" _msgList set [_forEachIndex, [_payload, -1, time]];" \n
" } else {" \n
" _msgList set [_forEachIndex, [_payload, _interval, time]];" \n
" };" \n
" };" \n
"} forEach _msgList;"/*%FSM</STATEINIT""">*/;
ok now that's done we need to go down near the bottom of the file and find this bit of code
Code:
/*%FSM</STATE>*/
/*%FSM<STATE "prepare">*/
class prepare
{
name = "prepare";
init = /*%FSM<STATEINIT""">*/"private [""_safety"", ""_lastSyncTime"", ""_lastCleanDead"", ""_lastCleanObjs"", ""_lastUpdateVeh""];" \n
"diag_log (""CLEANUP: INITIALIZING CLEANUP SCRIPT"");" \n
"" \n
"_safety = dayz_serverObjectMonitor;" \n
"" \n
"_lastSyncTime = time;" \n
"_lastCleanDead = time;" \n
"_lastCleanObjs = time;" \n
"_lastUpdateVeh = time;"/*%FSM</STATEINIT""">*/;
And as before we're going to put some code in the midde so
right after this line
Code:
"_safety = dayz_serverObjectMonitor;" \n
put this
Code:
"_msgList = msgList;" \n
"_crierGrp = createGroup sideLogic;" \n
"_crier = _crierGrp createUnit [""Survivor2_DZ"", [-2500, 0, 0], [], 0, ""NONE""];" \n
so if we've done it right it should look like this
Code:
/*%FSM</STATE>*/
/*%FSM<STATE "prepare">*/
class prepare
{
name = "prepare";
init = /*%FSM<STATEINIT""">*/"private [""_safety"", ""_msgList"", ""_crier"", ""_lastSyncTime"", ""_lastCleanDead"", ""_lastCleanObjs"", ""_lastUpdateVeh""];" \n
"diag_log (""CLEANUP: INITIALIZING CLEANUP SCRIPT"");" \n
"" \n
"_safety = dayz_serverObjectMonitor;" \n
"_msgList = msgList;" \n
"_crierGrp = createGroup sideLogic;" \n
"_crier = _crierGrp createUnit [""Survivor2_DZ"", [-2500, 0, 0], [], 0, ""NONE""];" \n
"" \n
"_lastSyncTime = time;" \n
"_lastCleanDead = time;" \n
"_lastCleanObjs = time;" \n
"_lastUpdateVeh = time;"/*%FSM</STATEINIT""">*/;
Ok that's that for the server_cleanup
Now for the server_monitor.sqf
find this bit of code
Code:
waitUntil{initialized};
_key = format["CHILD:302:%1:", dayZ_instance];
_data = "HiveEXT" callExtension _key;
Once again putting some code in the middle
So after this line
Code:
waitUntil{initialized};
put this
Code:
_key = format["CHILD:999:select payload, loop_interval, start_delay from message where instance_id = ?:[%1]:", dayZ_instance];
_data = "HiveEXT" callExtension _key;
diag_log("SERVER: Fetching messages...");
//Process result
_result = call compile format ["%1", _data];
_status = _result select 0;
msgList = [];
_msgCount = 0;
if (_status == "CustomStreamStart") then {
_val = _result select 1;
for "_i" from 1 to _val do {
_data = "HiveEXT" callExtension _key;
_result = call compile format ["%1",_data];
_status = _result select 0;
msgList set [count msgList, _result];
_msgCount = _msgCount + 1;
};
diag_log ("SERVER: Added " + str(_msgCount) + " messages!");
};
The whole thing should look like this, note that I've got some "\\Send the key" comments in but probably don't need it as they're only comments
Code:
waitUntil{initialized};
//Send the key
_key = format["CHILD:999:select payload, loop_interval, start_delay from message where instance_id = ?:[%1]:", dayZ_instance];
_data = "HiveEXT" callExtension _key;
diag_log("SERVER: Fetching messages...");
//Process result
_result = call compile format ["%1", _data];
_status = _result select 0;
msgList = [];
_msgCount = 0;
if (_status == "CustomStreamStart") then {
_val = _result select 1;
for "_i" from 1 to _val do {
_data = "HiveEXT" callExtension _key;
_result = call compile format ["%1",_data];
_status = _result select 0;
msgList set [count msgList, _result];
_msgCount = _msgCount + 1;
};
diag_log ("SERVER: Added " + str(_msgCount) + " messages!");
};
//Send the key
_key = format["CHILD:302:%1:", dayZ_instance];
_data = "HiveEXT" callExtension _key;
And that's it! Put the files back in the server.pbo and upload
To make a message in the database
Open the MESSAGES table
Click INSERT tab at top
ID - This is sequential, start with the number 1
PAYLOAD - the actual message you want displayed
LOOP_INTERVAL - how many SECONDS before this message displays again
START_DELAY - how many SECONDS before this message starts the first display
INSTANCE_ID - select your instance ID, do NOT leave it null
Again don't take credit for this as I got it somewhere else that I can't remember.