Jump to content
Mattmad1234

Disable JIP after 5 minutes have passed

Recommended Posts

Good Evening!

I am working on a way to respawn a player after 5 minutes have passed on a mission if they joined in progress. Currently I am using this script below in the initPlayerLocal.sqf However, What happens is that the sleep is not local to the server but the player. Meaning that if they Join in Progress, after 5 minutes they will be respawned. Is there a way to make this script based on server time and not local, so if they join the mission after 5 minutes have already passed server time, they will be respawned?

Spoiler

[] spawn {
sleep 300; 
if ([] call BIS_fnc_didJIP) then { forceRespawn player };
};

 

Share this post


Link to post
Share on other sites

I see what you are getting at here, but am a little confused on how I would actually implement that. (I'm a little new to scripting sorry...)

Share this post


Link to post
Share on other sites
4 hours ago, Mattmad1234 said:

I see what you are getting at here, but am a little confused on how I would actually implement that. (I'm a little new to scripting sorry...)

Could be something like this (untested):

 

//description.ext
class CfgDebriefing
{  
	class tooLate
	{
		title = "Too Late";
		subtitle = "";
		description = "Mission in progress, wait for restart to join again.";
		pictureBackground = "";
		picture = "b_inf";
		pictureColor[] = {0.0,0.3,0.6,1};
	};
};

//initServer.sqf
missionNamespace setVariable ["TAG_fnc_kickJIP",false,true];
_lockOut = [] spawn {
	waitUntil {serverTime > 300};
	missionNamespace setVariable ["TAG_fnc_kickJIP",true,true];
};

//initPlayerLocal.sqf
params ["_player","_didJIP"];
if (_didJIP AND missionNamespace getVariable ["TAG_fnc_kickJIP",false]) exitWith {
	"tooLate" call BIS_fnc_endMission;//will end mission locally for player
};

Cheers

  • Like 3
  • Thanks 1

Share this post


Link to post
Share on other sites

Yeah that! ^^

Sorry I couldn't be more help, it was just way too early for me to code haha. I made a rule. No coding after 2 am. Sh*t tends to get crazy otherwise. Nap time.

  • Like 2

Share this post


Link to post
Share on other sites
25 minutes ago, HazJ said:

Yeah that! ^^

Sorry I couldn't be more help, it was just way too early for me to code haha. I made a rule. No coding after 2 am. Sh*t tends to get crazy otherwise. Nap time.

Not a question of daytime, it's a question of how much coffee you had and if you're physically capable of making another mug o' black gold.

 

Cheers

  • Haha 1

Share this post


Link to post
Share on other sites

No coffee and couldn't be bothered to get up. I'm glued to my chair.

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

×