05-12-2006, 08:58 AM
Difficulty 1/5
Understanding 2/5 - must posses knowledge of code
What this does is allow GM's (or whatever access level you specify) to create items while in game.
CLIENT SIDE
in modClientTCP add the following:
Explanation: this sends the packet to the server with your index number (for checking), and the item data. Where you see the "SEP_CHAR & 1 & SEP_CHAR" you can specify any number here you want. I chose 1 just for the heck of it. The server will only spawn 1 item regardless, unless spawning a stackable item such as gold.
in Sub HandleKeyPresses FIND the following:
after the "End If" add the following:
Explanation: This is the command to tell the client to send the above packet. You must use the following to create an item:
Note: # is the item number. On my server, gold is item number 1. So using "/make 1" would spawn 1 gold piece under me. The amount spawned can be changed (as stated above).
SERVER SIDE
in modHandleData add the following before the last "End Sub":
Explanation:
1. Checks to see if the "MyIndex" is of access level 3 or higher, if not it exits the sub.
2. It spawns the item using the data sent by the packet.
3. Sends a message to everyone stating that a GM has created an item, just for kicks.
4. Logs the action. If you have log handler's this will be useful when the logs are checked to make sure that someone hasn't used a hacked client to create an item. Though, the global message will give them away anyways.
That's it. If anyone has problems just post them. I ran it twice and tried it all and it seemed to work fine. Don't worry about using numbers that are out of range... it just doesn't create the item, and doesn't cause the server/client to crash.
This can be greatly optimized and when I do get around to adding on to this function I will update this post. Enjoy
Understanding 2/5 - must posses knowledge of code
What this does is allow GM's (or whatever access level you specify) to create items while in game.
CLIENT SIDE
in modClientTCP add the following:
Code:
Sub SendMakeItem(ByVal ItemNum As Long)
Dim Packet As String
Packet = "SPAWNITEM" & SEP_CHAR & MyIndex & SEP_CHAR & ItemNum & SEP_CHAR & 1 & SEP_CHAR & GetPlayerMap(MyIndex) & SEP_CHAR & GetPlayerX(MyIndex) & SEP_CHAR & GetPlayerY(MyIndex) & SEP_CHAR & END_CHAR
Call SendData(Packet)
End Sub
in Sub HandleKeyPresses FIND the following:
Code:
' Editing shop request
If Mid(MyText, 1, 9) = "/editshop" Then
Call SendRequestEditShop
MyText = ""
Exit Sub
End If
after the "End If" add the following:
Code:
If Mid(MyText, 1, 5) = "/make" Then
If Len(MyText) > 5 Then
ChatText = Mid(MyText, 6, Len(MyText) - 1)
Call SendMakeItem(Val(Trim(ChatText)))
Else
Call AddText("Usage: /make ", AlertColor)
End If
MyText = ""
Exit Sub
End If
Code:
/make #
SERVER SIDE
in modHandleData add the following before the last "End Sub":
Code:
'::::::::::::::::::::::
':: Spawn a Map Item ::
'::::::::::::::::::::::
If LCase(Parse(0)) = "spawnitem" Then
If GetPlayerAccess(Val(Parse(1))) < 3 Then
Call PlayerMsg(Val(Parse(1)), "Admin only function!", AlertColor)
Exit Sub
End If
Call SpawnItem(Val(Parse(2)), Val(Parse(3)), Val(Parse(4)), Val(Parse(5)), Val(Parse(6)))
Call GlobalMsg(GetPlayerName(Parse(1)) & " uses his divine power to create an item!", GlobalColor)
Call AddLog(GetPlayerName(Parse(1)) & " created an item.", ADMIN_LOG)
Exit Sub
End If
1. Checks to see if the "MyIndex" is of access level 3 or higher, if not it exits the sub.
2. It spawns the item using the data sent by the packet.
3. Sends a message to everyone stating that a GM has created an item, just for kicks.
4. Logs the action. If you have log handler's this will be useful when the logs are checked to make sure that someone hasn't used a hacked client to create an item. Though, the global message will give them away anyways.
That's it. If anyone has problems just post them. I ran it twice and tried it all and it seemed to work fine. Don't worry about using numbers that are out of range... it just doesn't create the item, and doesn't cause the server/client to crash.
This can be greatly optimized and when I do get around to adding on to this function I will update this post. Enjoy
