Results 1 to 3 of 3
  1. #1
    Wampwire's Avatar
    Join Date
    Jun 2013
    Gender
    male
    Location
    United Kingdom of Tea
    Posts
    227
    Reputation
    10
    Thanks
    22
    My Mood
    Devilish

    New Gui Screen For Clients

    Not sure if this has been posted here before, but a quick refresher if it has.
    Were gona make a new Gui Screen... Allowing us to display many things, anything from the info about our client to the enabled hacks, player name, etc...

    To get started lets first create a new class. In that class, were gona have 3 methods.

    Code:
    public void initGui() {}
    This allows us to initiate Gui features such as the buttons. Yeah we could put them in another method, but for purposes of keeping it tidy we can put it here.

    As I said, we can put buttons on our new screen...
    So lets do that.
    In the void which we just created, lets add 2 buttons.
    Code:
    this.buttonList.add(new GuiSmallButton(0, this.width / 2 - 155, this.height / 4 + 120 + 12, "Back"));
    A buttonList is a button container - in plain English. What we do is take a button and add it into the container. So, we create a GuiSmallButton at specified x and y coordinates with a special ID code of 0 and the name "Back".

    So, our button is pretty much useless right now. Aint it?
    To make it a lil bit less useless, lets create a second void.
    Code:
    protected void actionPerformed(GuiButton par1GuiButton) {}
    We create a protected void so that it only applies to this class. actionPerformed.. Is an action listener, which listens to GuiButton.
    It works quite similarly to cases.. IE: case 1337: do this...
    Except we can have anything in this.
    To make our buttons more of.. A button, we create an if statement. If our parameter (par1GuiButton) is equal to the id code of the button then do this.

    Code:
    if (par1GuiButton.id == 0) {
        this.mc.displayGuiScreen(new HookMainMenu());
    }
    What this code does is it displays my hook screen if the button is pressed.
     

    If you want to exit the client, you can use a simple line.
    Code:
    else if (par1GuiButton.id == 1) {
        this.mc.shutdown();
    }


    Lastly for this class, we have to create a drawScreen void.
    You see, if we had all of our stuff in the initGui void, it'll be messy and the screen would constantly flicker back and forth between your gui and the old gui.

    For the draw screen, do this...
    Code:
        public void drawScreen(int par1, int par2, float par3) { //Creates a method with 3 parameters.
        	
        	this.drawDefaultBackground(); //Draws a default background (DIRT)
        	this.drawCenteredString(this.fontRenderer, "- Client Menu -", this.width / 2, this.height / 4 - 60 + 20, 16777215); //Fancy drawString
        	
        	super.drawScreen(par1, par2, par3); //Super (override (superior)) so the void displays.
        }
    A final thing which we have to do is create a way to access this screen. Go to your place of your liking. Mines a MainMenu hook. Create a button (similar way to above). And then when the button is pressed, do something like this.

    Code:
    if (par1GuiButton.id == 15) {
        this.mc.displayGuiScreen(new GuiClientMenu());
    }
    Obviously replacing the class name with yours and the button id.


    Sorry for the sloppy code and tutorial, tired and its 00:34 so yup.




    Ill.. pretend to be.. Bob Ross.

    "Our custom screen.. Its.. A creation. Let it be what you want it to be. You want a button on there? Lets create a happy little button. Now you have to create a major decision. Where does your button live. Right there. Oh Whats that? You want few more? Why not add another 5, but lets change them; dont want them to look miserable now, do you. Let your imagination go wild and paint it for you. Sit back and enjoy." - Well.. thats.. pretty much me than Bob But hey.. Be creative!

    Last edited by Wampwire; 09-05-2013 at 05:38 PM.

  2. #2
    Zeffer's Avatar
    Join Date
    Jun 2013
    Gender
    male
    Posts
    160
    Reputation
    12
    Thanks
    204
    My Mood
    Blah
    Looks like a nice tutorial, good job man!

  3. #3
    I'M GONNA HAVE TO EAT EVERY F--KING CHICKEN
    MPGH Member
    Chris's Avatar
    Join Date
    Sep 2011
    Gender
    male
    Posts
    1,086
    Reputation
    29
    Thanks
    2,784
    My Mood
    Psychedelic
    Would be nice to see some screenshots of the outcome, but none the less good work
    Vouch Thread
    Thank or +rep me if I helped you ★


Similar Threads

  1. New log in screen for CFPH only
    By BUTO@BILAT in forum CrossFire PH Mods & Rez Modding
    Replies: 21
    Last Post: 10-09-2012, 07:51 PM
  2. [Release] New log in screen for CFPH only
    By BUTO@BILAT in forum CrossFire Mods & Rez Modding
    Replies: 2
    Last Post: 07-17-2012, 09:02 PM
  3. New Cross Fire Login Screen :) for "vitaliy z"
    By *[V]ModzXx in forum CrossFire Mods & Rez Modding
    Replies: 13
    Last Post: 08-05-2011, 10:41 AM
  4. New GUI back ground for a hack (hack in progress)
    By D3Dh0oker in forum Showroom
    Replies: 8
    Last Post: 07-17-2011, 03:39 PM
  5. My New Huge Screen for PC.
    By Wyo in forum General
    Replies: 41
    Last Post: 10-02-2010, 08:08 PM

Tags for this Thread