Jump to content
Azza FHI

How to check how long player has been disconnected from dedicated?

Recommended Posts

As the title suggests, does anyone know of a way of checking how long a player has been disconnected from a dedicated server?

Thanks

Share this post


Link to post
Share on other sites

You'd simply record the time they disconnected, and then when they re-connect work out the difference.

Share this post


Link to post
Share on other sites

ok thanks for the replies.

Situation: Will be running a mission that goes for ~4 days. when player JIP's they have the option to spawn to captured spawn points, but in order to prevent misuse of this system it needs to only fire if the player has been absent from the server for 30 minutes.

This is what ive got so far (in the process of testing if it will work.

initplayerlocal.sqf

while {true} do {
        waituntil {!isnull player};
        sleep 30;
        ["savePlayer", player] call pdw;
        ["saveInventory", [name player, player]] call pdw;
        profileNamespace setVariable ["player_time", servertime];
};
in our teleport system addon

clientinit.sqf

	private ['_time_check','_disconnected_time'];
	_time_check = profileNamespace getVariable "player_time";
	_disconnected_time = servertime - _time_check;

	if (_disconnected_time > 300) then { };
edit - 300 is for testing purposes

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

×