[TuT - A] [317]How to make a basic premium system

Results 1 to 9 of 9
  1. #1

    [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


  2. #2
    Proficient Member stability666 is offline
    MemberRank
    Jan 2009 Join Date
    Maine, USA.Location
    165Posts

    Re: How to make a basic premium system

    u shud put for 317 in the name of the tut.. but nice..

  3. #3

    Re: How to make a basic premium system

    It has nothing to do with 317 or 503 / 508, it's general...

  4. #4
    Member owner abz is offline
    MemberRank
    Feb 2008 Join Date
    Under Your BedLocation
    69Posts

    Re: [TuT - A] [317]How to make a basic premium system

    3 Errors..

  5. #5
    Account Upgraded | Title Enabled! khosh is offline
    MemberRank
    Aug 2008 Join Date
    Australia, NSWLocation
    467Posts

    Re: [TuT - A] [317]How to make a basic premium system

    Thank you :) nice and easy guide to follow

  6. #6
    Member DefMagee is offline
    MemberRank
    Nov 2009 Join Date
    TamworthLocation
    66Posts

    Re: [TuT - A] [317]How to make a basic premium system

    Nice Guide ima Show this to my mate.

  7. #7
    Novice stonytim is offline
    MemberRank
    Nov 2009 Join Date
    1Posts

    Re: [TuT - A] [317]How to make a basic premium system

    i came up on 100 errors after this.

  8. #8
    Apprentice ambientX is offline
    MemberRank
    Jul 2011 Join Date
    11Posts

    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);
    }

  9. #9
    Novice LordPariSh is offline
    MemberRank
    Oct 2011 Join Date
    1Posts

    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 :)



Advertisement