Sign in to follow this  
cGs! mIKE

[SOLVED] [Request] Server Messages on Intervals (implemented into infiSTAR now)

15 posts in this topic

Advertisement
On 3/31/2016 at 3:27 PM, infiSTAR said:

It might be that the exile system on the client wasn't fully loaded when this tries to init, if you start it from the init.sqf you can have it like

  Reveal hidden contents


/*
	by infiSTAR.de
	time in minutes
	[first occurrence after x min, show again after x min, text]
*/
NOTIFY_MSG_ARRAY = [
	[5, 30, 'This is a nice server'],  
	[8, 1, 'infiSTAR rules'],  
	[7, 45, 'yay \m/'],
	[15, 15, '15 minutes have passed, drink some water! (IRL NOT INGAME YOU PLEB)']
];

/* do not touch below */
[] spawn {
	waitUntil {!isNil 'ExileSystemThreadSleep'};
	{_x set [0,(_x select 0)*60];_x set [1,(_x select 1)*60];} forEach NOTIFY_MSG_ARRAY;
	LAST_NOTIFICATION_SHOWN = 0;
	_code = {
		{
			if(time > LAST_NOTIFICATION_SHOWN)then
			{
				ctrlDelete ((findDisplay 46) displayCtrl 117997);
				
				_timetostart = _x select 0;
				if(time > _timetostart)then
				{
					_selection = _x;
					_cooldown = _x select 1;
					_selection set [0,time + _cooldown];
					NOTIFY_MSG_ARRAY set [_forEachIndex,_selection];
					
					LAST_NOTIFICATION_SHOWN = time + 4;
					ctrlDelete ((findDisplay 46) displayCtrl 117997);
					_ctrl = (findDisplay 46) ctrlCreate['RscStructuredText', 117997];
					_ctrl ctrlSetPosition [safeZoneX + 0.1,SafeZoneY + 1,1,1];
					_ctrl ctrlSetScale 2;
					_ctrl ctrlCommit 0;
					_ctrl ctrlSetStructuredText parseText format['<t color=''#ff0000'' size=''0.6'' align = ''left'' font =''OrbitronMedium''>%1</t>',_x select 2];
					
					systemChat (_x select 2);
				};
			};
		} forEach NOTIFY_MSG_ARRAY;
	};
	msgthreadid = [0.5, _code, [], true] call ExileClient_system_thread_addtask;
};

 

this instead. The extra "spawn" thread with the waituntil will end as soon as the client is done loading the preInit so it is no persistent extra thread :)

I put it into init.sqf and copied this code

Share this post


Link to post
Share on other sites
Advertisement
Guest
This topic is now closed to further replies.
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.