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

Fix bug with consumable hotbar items


erkro1
 Share

Recommended Posts

This will fix the bug that when you use a consumable item through the hotbar it won't dissapear from the hotbar.

**Server side**

In modHandleData, in Sub HandleHotbarUse find:
```
Case 1 ' inventory
            For i = 1 To MAX_INV
                If Player(index).Inv(i).Num > 0 Then
                    If Player(index).Inv(i).Num = Player(index).Hotbar(Slot).Slot Then
                        UseItem index, i
                        Exit Sub
                    End If
                End If
            Next
```
Replace it with:
```
Case 1 ' inventory
            For i = 1 To MAX_INV
                If Player(Index).Inv(i).Num > 0 Then
                    If Player(Index).Inv(i).Num = Player(Index).Hotbar(Slot).Slot Then
                        If Item(Player(Index).Inv(i).Num).Type = ITEM_TYPE_CONSUME Then
                            Player(Index).Hotbar(Slot).Slot = 0
                            Player(Index).Hotbar(Slot).sType = 0
                            SendHotbar Index
                        End If
                        UseItem Index, i
                        Exit Sub
                    End If
                End If
            Next
```
Link to comment
Share on other sites

  • 2 weeks later...
> Thanks agian for another perfectly working tutorial.

Your welcome. ![;)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/wink.png)

> This bug crashes my server everyday,thx

This bug could never crash your server, anyway, if you don't like the bugfix/tutorial then don't post.
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...