Okay. I manipulated the code to work with what you want. It won’t affect the other use the code has.
Replace the subs CheckMapGetItem (client), HandleMapGetItem (Server), and PlayerMapGetItem (Server) with the code I post below.
Sub CheckMapGetItem(Optional ByVal X As Long = 0, Optional ByVal Y As Long = 0)
Dim Buffer As New clsBuffer
' If debug mode, handle error then exit out
If Options.Debug = 1 Then On Error GoTo errorhandler
Set Buffer = New clsBuffer
If timeGetTime > Player(MyIndex).MapGetTimer + 250 Then
If Trim$(MyText) = vbNullString Then
Player(MyIndex).MapGetTimer = timeGetTime
Buffer.WriteLong CMapGetItem
Buffer.WriteLong X
Buffer.WriteLong Y
SendData Buffer.ToArray()
End If
End If
Set Buffer = Nothing
' Error handler
Exit Sub
errorhandler:
HandleError "CheckMapGetItem", "modGameLogic", Err.Number, Err.Description, Err.Source, Err.HelpContext
Err.Clear
Exit Sub
End Sub
Private Sub HandleMapGetItem(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
Dim Buffer As clsBuffer
Dim X As Long, Y As Long
Set Buffer = New clsBuffer
Buffer.WriteBytes Data()
X = Buffer.ReadLong
Y = Buffer.ReadLong
Set Buffer = Nothing
Call PlayerMapGetItem(index, X, Y)
End Sub
Sub PlayerMapGetItem(ByVal index As Long, Optional X As Long = 0, Optional Y As Long = 0)
Dim i As Long
Dim n As Long
Dim MapNum As Long
Dim Msg As String
If Not IsPlaying(index) Then Exit Sub
MapNum = GetPlayerMap(index)
If X = 0 Then X = GetPlayerX(index)
If Y = 0 Then Y = GetPlayerY(index)
For i = 1 To MAX_MAP_ITEMS
' See if theres even an item here
If (MapItem(MapNum, i).Num > 0) And (MapItem(MapNum, i).Num <= MAX_ITEMS) Then
' our drop?
If CanPlayerPickupItem(index, i) Then
' Check if item is at the same location as the player
If (MapItem(MapNum, i).X = X) Then
If (MapItem(MapNum, i).Y = Y) Then
' Find open slot
n = FindOpenInvSlot(index, MapItem(MapNum, i).Num)
' Open slot available?
If n <> 0 Then
' Set item in players inventor
Call SetPlayerInvItemNum(index, n, MapItem(MapNum, i).Num)
If Item(GetPlayerInvItemNum(index, n)).Type = ITEM_TYPE_CURRENCY Then
Call SetPlayerInvItemValue(index, n, GetPlayerInvItemValue(index, n) + MapItem(MapNum, i).Value)
Msg = MapItem(MapNum, i).Value & " " & Trim$(Item(GetPlayerInvItemNum(index, n)).Name)
Else
Call SetPlayerInvItemValue(index, n, 0)
Msg = Trim$(Item(GetPlayerInvItemNum(index, n)).Name)
End If
' Erase item from the map
ClearMapItem i, MapNum
Call SendInventoryUpdate(index, n)
Call SpawnItemSlot(i, 0, 0, GetPlayerMap(index), 0, 0)
SendActionMsg GetPlayerMap(index), Msg, White, 1, (GetPlayerX(index) * 32), (GetPlayerY(index) * 32)
Exit For
Else
Call PlayerMsg(index, "Your inventory is full.", BrightRed)
Exit For
End If
End If
End If
End If
End If
Next
End Sub