This short tutorial will give you an easy way to kick those AFK members from your game. (Assuming they’ve been gone for a long time, or for whatever reason) anyways lets get to it.
All Server Sided:
Go to modConstants and add:
Public Const INACTIVE_DURATION As Long = 10000 ' This is 10 seconds. (This is how long before kicked for being inactive)
Now go to modTypes and at
TempPlayerRec add at the bottom:
LastActive As Long
Next look for the sub “
HandleData(ByVal index as Long, ByRef Data() As Byte)”
CallWindowProc HandleDataSub(MsgType), index, Buffer.ReadBytes(Buffer.Length), 0, 0 put there:
TempPlayer(Index).LastActive = GetTickCount
Finally head over to gameloop and look for
' Check for disconnections every half second
If Tick > tmr500 Then For i = 1 To MAX_PLAYERS
If IsPlaying(i) Then ' Check to see if they've been inactive for too long. If Tick - TempPlayer(i).LastActive >INACTIVE_DURATION And TempPlayer(i).LastActive <> 0 Then Call CloseSocket(i) End If
That should be it make sure to test this one is working properly (I may have forgotten something but i think i got everything) let me know if any questions.