Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

AFK System - Problem


Wortel Angels
 Share

Recommended Posts

```

If Player(Index).Moving = 0 And Player(Index).AFK = 0 Then

If Player(Index).AFKTimer + 30000 <= GetTickCount Then

If Player(Index).Sitting = 1 Then

SendAFK

SendSitting

Else

SendAFK

End If

Player(Index).AFKTimer = GetTickCount

End If

ElseIf Player(Index).Moving = 1 And Player(Index).AFK = 1 Then

SendAFK

End If

```

Thats my AFK System

It should work like:

If youre not walking and not afk already

-> Counter 30 Seconds

–> Set you afk

If youre walking and afk then

-> Set you back to not AFK

The Problem:

If 2 players are on the map and one is moving around then is the second resetting his AFK status

Same for if 2 are afk and one start moving again -> Afk = 0 on both

(Ignore the sitting stuff thats working)

Fixed--

Needed to move the setting afk stuff to the client loop
Link to comment
Share on other sites

```

If Player(Index).AFK = 0 And Player(Index).Moving = 0 Then

If Player(Index).AFKTimer + 30000 <= GetTickCount Then

If Player(Index).Sitting = 1 Then

SendSitting

End If

SendAFK

Player(Index).AFKTimer = GetTickCount

End If

ElseIf Player(Index).Moving = 1 And Player(Index).AFK = 1 Then

SendAFK

End If

```
I revamped the code a bit. Btw use the timer and AFK in tempplayerrec

And about the SendAFK and SendSitting I am assuming it is sent to the map. And the client appropriately does the stuff. Make sure the client is setting the AFK status of the required player that is only the player that is AFK off and not the player with index of (myindex)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...