Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

How to Add Admin Commands to a Game

Initiate Mage
Joined
Mar 24, 2018
Messages
2
Reaction score
5
EDIT :In this tutorial we create an admin command so thats why i chose PcCommandHandler.java. You could choose an other file, or create new one depending on what type of command you want to add.
If you guys want a tutorial on how to manage command permissions, create a new file for player command etc... pm me :p




Hey, welcome to this little tutorial, today i'll be showing you how to add a command to the game since we cannot do this via properties file, some of you might not know how to do this if you don't have the basics of Java :

I'm using the 661 client/server for this tutorial, it might be the same method as 491 client/server.

661 client/server :
http://forum.ragezone.com/f1000/661-wip-server-files-source-1149004/

1) Open "PcComandHandler.java" Location :
com.bdoemu.gameserver.scripts.commands

CQGCAro - How to Add Admin Commands to a Game - RaGEZONE Forums


At the top of the file, you can see this. Basically we're adding to a StringBuilder multiple strings, this is what you'll receive when you'll type "/pc" in game.

In this tutorial we'll do a "addfailstacks" command.


2) Add your command to the string builder

We'll add our command to the string builder, so when the admin type "/pc" he will see our command being sent to him.

fSEOD4k - How to Add Admin Commands to a Game - RaGEZONE Forums


3) Creating the command

Scroll down and let's create our command!

VZXb4pY - How to Add Admin Commands to a Game - RaGEZONE Forums


Lets begin by entering the method name and the parameters of this method:

2FJr2Uj - How to Add Admin Commands to a Game - RaGEZONE Forums


So basically we'll have to add a a number of failstacks that the player will choose, try catch the possible errors, add the failstacks and send a packet to the player so that the failstacks are being shown in the enhancement window.

297CeuN - How to Add Admin Commands to a Game - RaGEZONE Forums


First, we parse the string to an integer, in the same time we check if its integer and then we make sure that there is only 1 argument after the name of the command Ex : "/pc addfailstacks 30"

nCsR9w6 - How to Add Admin Commands to a Game - RaGEZONE Forums



We make sure that the failstack is over 0 to prevent issues.

BDJJxcv - How to Add Admin Commands to a Game - RaGEZONE Forums


Finally, we set the failstack to his current failstack + the chosen failstack. Then we send a packet to the player so that the enhancement window shows the correct number.

8HMAQSu - How to Add Admin Commands to a Game - RaGEZONE Forums


So the code should look like this now, you'll have to decompile the code and update it to the server, i hope you enjoyed this tutorial, if i made a mistake, just tell it to me :)
 

Attachments

You must be registered for see attachments list
Last edited:
Initiate Mage
Joined
Apr 30, 2020
Messages
4
Reaction score
1
Not Found for Me
or you can add the code to be able to copy it please?

Edite: I already solved it, thanks. by the way, the code is wrong.
 
Last edited:
Back
Top