Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dont Regen When Full
#1
You Must add this!
Difficult: 1/5

Currently the server send the regen hp, mp and sp each 10 seconds, even if you have max in all of them. This means that each minute you send 18 packets which are not used. Just consider if that was the case and there were 10 players online, 180 packets/min to waste. And dont think about the hour: 10800packets! So do this quick thing and feel proud today.

Find this in the server:
Code:
Sub CheckGiveHP()
Dim i As Long, n As Long

    If GetTickCount > GiveHPTimer + 10000 Then
        For i = 1 To MAX_PLAYERS
            If IsPlaying(i) Then
                Call SetPlayerHP(i, GetPlayerHP(i) + GetPlayerHPRegen(i))
                Call SendHP(i)
                Call SetPlayerMP(i, GetPlayerMP(i) + GetPlayerMPRegen(i))
                Call SendMP(i)
                Call SetPlayerSP(i, GetPlayerSP(i) + GetPlayerSPRegen(i))
                Call SendSP(i)
            End If
            DoEvents
        Next i
        
        GiveHPTimer = GetTickCount
    End If
End Sub
Replace it with:
Code:
Sub CheckGiveHP()
Dim i As Long, n As Long

    If GetTickCount > GiveHPTimer + 10000 Then
        For i = 1 To MAX_PLAYERS
            If IsPlaying(i) Then
                If GetPlayerHP(i)  GetPlayerMaxHP(i) Then
                    Call SetPlayerHP(i, GetPlayerHP(i) + GetPlayerHPRegen(i))
                    Call SendHP(i)
                End If
                If GetPlayerMP(i)  GetPlayerMaxMP(i) Then
                    Call SetPlayerMP(i, GetPlayerMP(i) + GetPlayerMPRegen(i))
                    Call SendMP(i)
                End If
                If GetPlayerSP(i)  GetPlayerMaxSP(i) Then
                    Call SetPlayerSP(i, GetPlayerSP(i) + GetPlayerSPRegen(i))
                    Call SendSP(i)
                End If
            End If
            DoEvents
        Next i
        
        GiveHPTimer = GetTickCount
    End If
End Sub

You could also change 10000 to 20000 so instead of sending the packet each 10 seconds it sends it with 20, less packets Tongue
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)