Calculating player idle time?
if made a plugin to calculate playtime per wipe what happens is apon player disconnect this code fires witch places connected time to datafile

float count = 0;
if (playFile[player.UserIDString,player.displayName] == null)
{
count = 0;
}
else
{
count = float.Parse(playFile[player.UserIDString,player.displayName].ToString());
}
float result = (count + player.net.connection.GetSecondsConnected() - CheckIdleTime(player));
playFile[player.UserIDString , player.displayName] = result;
playFile.Save();

and idle time gets calcutlated with this function

float CheckIdleTime(BasePlayer player)
{
float time = 0;
if (player.IdleTime >= 240)
{

time = player.IdleTime;
}
return time;
}

but i need a way to get that deducted when player gets out of ille aswell not just if he disconnects while in idle

if someone can help maybe im doing this wrong all input would help

thanks
NooBlet
the end goal was to give players a command at end wipe for gifts if they played the minimal hours per wipe
Have you taken a look a plugins such as Playtime Tracker or AFK?
i have wulf . i use playtime tracker but im not a as good with coding as i should and dont understand how k1llyou did it but ill have a look at it again ...
thanks for the reply
You can check every 5 minutes if player is idle, use
player.IdleTime​

And then if he is idle:
1. Create variable for idle time
2. Change connection time
player.net.connection.connectionTime += 300;