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

Small Loop Issue


Skillzalot
 Share

Recommended Posts

Im trying to make my Take Item once code works but something is wrong with the loop

```
Case 5 'Take item
                        If Conv(convNum).Conv(curChat).Data3 = 1 Then
                            For i = 1 To MAX_CONVS
                            If Player(Index).TakeItemOnceStatus(i) <> 1 Then
                                If HasItem(Index, Conv(convNum).Conv(curChat).Data1) Then
                                    TakeInvItem Index, Conv(convNum).Conv(curChat).Data1, Conv(convNum).Conv(curChat).Data2
                                    SendActionMsg GetPlayerMap(Index), Conv(convNum).Conv(curChat).Data2 & Trim$(Item(Conv(convNum).Conv(curChat).Data1).Name) & " " & "removed", White, 1, (GetPlayerX(Index) * 32), (GetPlayerY(Index) * 32)
                                    Player(Index).TakeItemOnceStatus(convNum) = 1
                                Else
                                    SendActionMsg GetPlayerMap(Index), "You don't have any", Red, 1, (GetPlayerX(Index) * 32), (GetPlayerY(Index) * 32)
                                End If
                            Else
                                SendActionMsg GetPlayerMap(Index), "You already gave me this item", BrightRed, 1, (GetPlayerX(Index) * 32), (GetPlayerY(Index) * 32)
                            End If
                            Next
                        Else
                            If HasItem(Index, Conv(convNum).Conv(curChat).Data1) Then
                                TakeInvItem Index, Conv(convNum).Conv(curChat).Data1, Conv(convNum).Conv(curChat).Data2
                                SendActionMsg GetPlayerMap(Index), Conv(convNum).Conv(curChat).Data2 & Trim$(Item(Conv(convNum).Conv(curChat).Data1).Name) & " " & "removed", White, 1, (GetPlayerX(Index) * 32), (GetPlayerY(Index) * 32)
                            Else
                                SendActionMsg GetPlayerMap(Index), "You don't have any", Red, 1, (GetPlayerX(Index) * 32), (GetPlayerY(Index) * 32)
                            End If
                        End If
```
I also added TakeItemOnceStatus(1 To MAX_CONVS) As Byte
to the player rec in both client and server

If i want to take the item multiple times it works but if i try to give the item only once instead of stopping at that specific chat it loops through all of them some help would be amazing,
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...