Welcome, guest! Please login or register.

    * Shoutbox

    RefreshHistory
    • hexedss1: Anyone would like to help on client side got a variable declartion Error
      Today at 09:06:30 PM
    • SOUPSOUP: just get a vpn
      August 13, 2018, 06:44:28 PM
    • jme: _^_ will answer all of your javascript questions
      August 12, 2018, 07:11:00 PM
    • doomsale: and where is boxman?
      August 10, 2018, 03:16:59 AM
    • doomsale: Where can i play the Moparscape MMORPG with the Metallica instrumentals?
      August 10, 2018, 03:16:47 AM
    • doomsale: no longer clicking on doors and dummies at east bank
      August 10, 2018, 03:16:07 AM
    • doomsale: were all grown up now huh?
      August 10, 2018, 03:15:58 AM
    • _^_: hey everyone look at my graphs [link]
      August 06, 2018, 01:52:16 PM
    • braedyn: Someone pl0x help me out with PI Lottery!!
      August 03, 2018, 02:12:25 AM
    • Travas: p3n1s
      July 26, 2018, 09:46:33 PM
    • Krackkid: You up :eggplant:
      July 23, 2018, 06:18:17 PM
    • DeathsChaos9: no
      July 23, 2018, 03:53:31 PM
    • Emulous: Come check out Emulous: [link]
      July 22, 2018, 03:37:19 PM
    • Emulous:[link]
      July 22, 2018, 03:37:00 PM
    • Travas: ur mom
      July 21, 2018, 06:04:50 PM
    • YNRDAB: Watcha big ballers up too?
      July 20, 2018, 11:01:06 AM
    • dark250: i need help for coding client
      July 19, 2018, 08:27:37 AM
    • Travas: yes
      July 14, 2018, 02:19:44 PM
    • drubrkletern: lmao racist and sexist much?
      July 14, 2018, 01:11:52 PM
    • Cole1497: yeah i got you lil boat give me a second
      July 13, 2018, 03:19:35 AM

    Author Topic: [317] [PI] Open Interface command  (Read 1844 times)

    0 Members and 1 Guest are viewing this topic.

    OfflineAlexander-Staneke

    • Member
    • **
    • Posts: 46
    • Thanks: +0/-0
      • View Profile
    [317] [PI] Open Interface command
    « on: June 10, 2016, 06:48:36 PM »
    So I noticed there's no command to be found to open a interface, so I took the honour and made it for you guys.

    Command usage: ::intf [ID]

    Code: [Select]
    if (playerCommand.startsWith("intf") && c.playerRights >= 3) {
    try {
    String InterfaceId = playerCommand.substring(5);
    int ConvertedString = Integer.parseInt(InterfaceId);
    c.getPA().showInterface(ConvertedString);
    } catch(Exception e) {
    c.sendMessage("Interface error");
    }
    }

    I know it's not the most complicated code to write, but here it is.

    Hope you enjoy,
    Runescape Gambling

    Offlinerunescape sucks

    • Member
    • ****
    • Posts: 2,797
    • Thanks: +0/-0
      • View Profile
    Re: [317] [PI] Open Interface command
    « Reply #1 on: June 11, 2016, 06:28:38 PM »
    I mean, thanks, but this isn't really necessary. Besides, almost every PI server has a command very similar to this.

    Code: Java
    1.                 if(playerCommand.startsWith("interface")){
    2.                         String[] args = playerCommand.split(" ");
    3.                         c.getPA().showInterface(Integer.parseInt(args[1]));
    4.                 }
    (From a source I have on my computer)
    (click to show/hide)
    Runescape Gambling

    Offlinesk8rdude461

    • MOPARSCAPE WAS HACKED
    • Member
    • ****
    • *
    • Posts: 12,471
    • Thanks: +0/-0
      • View Profile
    Re: [317] [PI] Open Interface command
    « Reply #2 on: June 11, 2016, 10:39:37 PM »
    Those conventions are horrible Alexander-Staneke..
    Java Nuts and Bolts | Variables
    Should look up on the conventions for variable naming.

    I mean, thanks, but this isn't really necessary. Besides, almost every PI server has a command very similar to this.

    Code: Java
    1.                 if(playerCommand.startsWith("interface")){
    2.                         String[] args = playerCommand.split(" ");
    3.                         c.getPA().showInterface(Integer.parseInt(args[1]));
    4.                 }
    (From a source I have on my computer)
    Technically the OP's is better because it has a try-catch that'd prevent an error for a player typing ::interface ABC.

    Code: Java
    1.                 if(playerCommand.startsWith("interface")){
    2.                         try{
    3.                                 int interfaceId =Integer.parseInt(playerCommand.split(" ")[1]);
    4.                                 c.getPA().showInterface(interfaceId);
    5.                         }catch(Exception er){
    6.                                 c.sendMessage("Try the command as ::interface 1234");
    7.                         }
    8.                 }
    Runescape Gambling

     

    Copyright © 2017 MoparScape. All rights reserved.
    Powered by SMFPacks SEO Pro Mod |
    SimplePortal 2.3.5 © 2008-2012, SimplePortal