14.10.2016, 13:56
Hello Everybody,
In the previous tutorial i showed you how to generate project files to begin with. I will now show you how to go ahead and create your first gamemode :P
First of you need to download and install an applicable IDE with which you can code java in.
I use netbeans so I will provide the download link for netbeans.
NETBEANS: https://netbeans.org/downloads/
Go ahead and download the full version of netbeans like specified on the top.
Open up netbeans and go to the following tabs File -> Open Project... -> Project that you generated!
You will see the following when opening your project:
No go ahead and double click on your .java file (Its the name you provided when generating the project). Now you will see the following image where you will start coding your entry and exit points of your gamemode. This .java file will contain your so called OnGamemodeInit and OnGamemodeExit.
You will see that you instantiate a 'logger' variable as private. This means that you declared a variable that will only be used inside your current class and this logger will be used to send debugging messages to the command prompt.
The onEnable() and onDisable() methods can be seen as your OnGamemodeInit and OnGamemodeExit.
No go ahead and add this import under 'package'.
Now put the following code under your logger declaration like this.
This code will set the gamemode's text to whatever you are busy making and you can also set the server's hostname with the setHostname that's being extended from the svr.
Java is much more confusing for some people than pawn but if you go and investigate the problems for yourself you will easily get the hang of it.
In the next part of this tutorial i will show you show to create command handlers and the commands itself.
Stay tuned!
PEACE!
In the previous tutorial i showed you how to generate project files to begin with. I will now show you how to go ahead and create your first gamemode :P
First of you need to download and install an applicable IDE with which you can code java in.
I use netbeans so I will provide the download link for netbeans.
NETBEANS: https://netbeans.org/downloads/
Go ahead and download the full version of netbeans like specified on the top.
Open up netbeans and go to the following tabs File -> Open Project... -> Project that you generated!
You will see the following when opening your project:
No go ahead and double click on your .java file (Its the name you provided when generating the project). Now you will see the following image where you will start coding your entry and exit points of your gamemode. This .java file will contain your so called OnGamemodeInit and OnGamemodeExit.
You will see that you instantiate a 'logger' variable as private. This means that you declared a variable that will only be used inside your current class and this logger will be used to send debugging messages to the command prompt.
Code:
private Logger logger;
Code:
logger = getLogger();
No go ahead and add this import under 'package'.
Code:
package com.tutorial.gm; import net.gtaun.shoebill.object.Server;
Code:
@Override protected void onEnable() throws Throwable { logger = getLogger(); Server svr = Server.get(); svr.setGamemodeText("tutorial 1.1"); svr.setHostname("Your Gamemode Name"); }
Java is much more confusing for some people than pawn but if you go and investigate the problems for yourself you will easily get the hang of it.
In the next part of this tutorial i will show you show to create command handlers and the commands itself.
Stay tuned!
PEACE!