[TuT - A] [317]How to make a basic premium system
Open up client.java
Right under
Code:
public class client extends Player implements Runnable {
put
Code:
public int premium;
search for:
Code:
characterfile.write(Integer.toString(playerGameCount), 0, Integer.toString(playerGameCount).length());
under that put:
Code:
characterfile.newLine();
characterfile.write("character-premium = ", 0, 22);
characterfile.write (Integer.toString (premium), 0, Integer.toString (premium).length());
Next search for:
Code:
if (command.startsWith("giveadmin") && playerRights >= 3) {
right above that put:
Code:
if (command.startsWith("givepremium") && playerRights >= 3) {
String name = command.substring(10);
try {
int p = PlayerHandler.getPlayerID(name);
client c = (client) server.playerHandler.players[p];
c.premium = 1;
c.savemoreinfo();
c.savechar();
c.disconnected = true;
PlayerHandler.messageToAll = (name + " is now a Premium Member");
} catch (Exception e) {
sendMessage(name + " either isn't online or doesn't exist");
}
Now you are done with setting up the system...
Now you will learn how to add premium only commands...
Above what you just added, put something like this.
Code:
if (command.startsWith("premiumcash") && premium >= 1) {
addItem(995, 2147000000);
}
Tutorial written by Tyggo aka Vengeance
Re: How to make a basic premium system
u shud put for 317 in the name of the tut.. but nice..
Re: How to make a basic premium system
It has nothing to do with 317 or 503 / 508, it's general...
Re: [TuT - A] [317]How to make a basic premium system
Re: [TuT - A] [317]How to make a basic premium system
Thank you :) nice and easy guide to follow
Re: [TuT - A] [317]How to make a basic premium system
Nice Guide ima Show this to my mate.
Re: [TuT - A] [317]How to make a basic premium system
i came up on 100 errors after this.
Re: [TuT - A] [317]How to make a basic premium system
You can go into commands.java and anywere put in
if(c.playerRights >= 1) { //Premium
and just add you premium commands underneath it...
Same goes with anyother commands
* Just remove && premium >= 1) {
*And to tidy up your coding add && premium >= 1) { under if (command.startsWith("premiumcash")
So it looks like this
if (command.startsWith("premiumcash")
c.getrights && premium >= 1) {
addItem(995, 2147000000);
}
Re: [TuT - A] [317]How to make a basic premium system
When I do ::givepremium (namehere)
1. I need to put space 3 times before I type their name
2. It says they're offline even when they are on. I think it's simply because of the 3 spaces thing.
Anyway, hope someone can help :)