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

Equipped Items


Zamin
 Share

Recommended Posts

@Lam3r:

> Yep,```
> Function GetInvItemslot(index, F_item_num, F_Min_value, F_Min_dur)
> ```
> And the command list you should be looking @ now is [HERE](http://www.touchofdeathforums.com/smf/index.php/topic,28153.0.html)
>
> ~ Lam3r

How do I use this function to check whether the given item is equipped or not?
Link to comment
Share on other sites

```
Function IsPlayerSlotEquipped(Index, Slot)
If GetPlayerArmorSlot(Index) = Slot Then
IsPlayedItemEquiped = True

Exit Function
End If

If GetPlayerWeaponSlot(Index) = Slot Then
IsPlayedItemEquiped = True

Exit Function
End If

If GetPlayerHelmetSlot(Index) = Slot Then
IsPlayedItemEquiped = True

Exit Function
End If

If GetPlayerShieldSlot(Index) = Slot Then
IsPlayedItemEquiped = True

Exit Function
End If

If GetPlayerNecklaceSlot(Index) = Slot Then
IsPlayedItemEquiped = True

Exit Function
End If

If GetPlayerRingSlot(Index) = Slot Then
IsPlayedItemEquiped = True

Exit Function
End If

If GetPlayerLegsSlot(Index) = Slot Then
IsPlayedItemEquiped = True

Exit Function
End If

Is PlayedItemEquiped = False
End Function
```
If you want to know if a given item is equipped instead of slot, then use this:
```
Function IsPlayerSlotEquipped(Index, Item)
Dim Slot

Slot = 0

For SearchSlot = 1 To MAX_INVSLOTS
If GetPlayerInvItemNum(Index, SearchSlot) = Item Then
Slot = SearchSlot

Exit For
End If
Next

If Slot = 0 Then
IsPlayedItemEquiped = False

Exit Function
End If

If GetPlayerArmorSlot(Index) = Slot Then
IsPlayedItemEquiped = True

Exit Function
End If

If GetPlayerWeaponSlot(Index) = Slot Then
IsPlayedItemEquiped = True

Exit Function
End If

If GetPlayerHelmetSlot(Index) = Slot Then
IsPlayedItemEquiped = True

Exit Function
End If

If GetPlayerShieldSlot(Index) = Slot Then
IsPlayedItemEquiped = True

Exit Function
End If

If GetPlayerNecklaceSlot(Index) = Slot Then
IsPlayedItemEquiped = True

Exit Function
End If

If GetPlayerRingSlot(Index) = Slot Then
IsPlayedItemEquiped = True

Exit Function
End If

If GetPlayerLegsSlot(Index) = Slot Then
IsPlayedItemEquiped = True

Exit Function
End If

Is PlayedItemEquiped = False
End Function
```
Also, if you aren't using GM and if MAX_INVSLOTS isn't defined then add:
```
Public Const MAX_INVSLOTS = 24
```as well.

Regards,
  Godlord.
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...