Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Make Item Command - Client Command
#6
To make it spawn straight into the inventory just do this:

Server side, find this line
Code:
'Call SpawnItem(Val(Parse(2)), Val(Parse(3)), Val(Parse(4)), Val(Parse(5)), Val(Parse(6)))
I'll give you a hint, that code is in the packet you just added to your server while following Leighland's Tuorial Wink

Anyways, comment or remove the line I posted above, and replace it with this:
Code:
Call GiveItem(Parse(1), Val(Parse(2)), Val(Parse(3)))

Now I also noticed that you can only spawn 1 item at a time, which isn't a bad thing unless you want to spawn a currency. That's where these modifications come in handy. You should already know that these belong client. Just replace what you added while following Leighland's tutorial.

Code:
' Spawn Item
            If Mid(MyText, 1, 5) = "/make" Then
                If Len(MyText) > 5 Then
                    ChatText = Mid(MyText, 6, Len(MyText) - 1)
                    ' Find The Item Number to Spawn
                    i = Val(Mid(MyText, 7, 3)) ' Your Item Number MUST be 3 digits. 001 - 999
                    ' Find The Desired Amount to Spawn
                    n = Val(Mid(MyText, 11, 3)) ' Change the 3 to a 4 if you want to spawn into the thousands
                    
                    Call SendMakeItem(i, n)
                Else
                    Call AddText("Usage: /make  ", AlertColor)
                End If
                MyText = ""
                Exit Sub
            End If

Code:
Sub SendMakeItem(ByVal ItemNum As Long, ByVal ItemVal As Long)
Dim Packet As String

    Packet = "SPAWNITEM" & SEP_CHAR & MyIndex & SEP_CHAR & ItemNum & SEP_CHAR & ItemVal & SEP_CHAR & GetPlayerMap(MyIndex) & SEP_CHAR & GetPlayerX(MyIndex) & SEP_CHAR & GetPlayerY(MyIndex) & SEP_CHAR & END_CHAR
    Call SendData(Packet)
End Sub


There, now you can choose which item number and HOW MANY of that item will be spawned. Example

/make 001 500 - That would spawn 500 of item 1 (gold in my case)
Yes, each value must be triple digits. Though, the code is commented and tells you more about that Wink
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)