Welcome, guest! Please login or register.

    * Shoutbox

    RefreshHistory
    • stCky: idk man im just a chat bot
      August 22, 2017, 11:14:52 PM
    • symantec: is this forum
      August 22, 2017, 09:02:56 PM
    • symantec: what the fudge
      August 22, 2017, 09:02:52 PM
    • symantec: I just joined to download datmaker, the links are broken and a user named i nelson i has a fudgeing weird signature
      August 22, 2017, 08:59:33 PM
    • stCky: ur so cool and edgy
      August 22, 2017, 04:15:50 PM
    • Deathspirit: anyways, i'm un ip banned now.. but don't even want to be that at this point lmfao
      August 22, 2017, 01:58:14 PM
    • Deathspirit: now it's some sell out half leeched server :')
      August 22, 2017, 01:57:53 PM
    • Deathspirit: gf moparscape, was the best rsps community i've been on since 2006
      August 22, 2017, 01:57:31 PM
    • stCky: yeah, nah. it's cooked. [link] might help u with a backup or something idk man im just a chat bot
      August 22, 2017, 12:13:25 AM
    • flew420: I sure hope someone has a copy of the forum before it was recked
      August 21, 2017, 11:40:52 PM
    • flew420: O wow i see now, just read thru all the news articles. :(  i've been out of the game for a couple years so coming back to this shit is sad.
      August 21, 2017, 11:39:46 PM
    • flew420: Huh?
      August 21, 2017, 10:49:51 PM
    • stCky: got bought by a russian dude, he put a shitty rsps on it for donations, now no one cares
      August 21, 2017, 10:48:30 PM
    • flew420: I came on for some nostalgic reading in old classic development, and it only goes back to 2014 wtf.
      August 21, 2017, 10:43:09 PM
    • flew420: what happened to this site??
      August 21, 2017, 10:42:36 PM
    • Sean56:[link]
      August 21, 2017, 05:33:45 PM
    • kb010: how can i play? i downloaded the client and it doesnt open.
      August 21, 2017, 10:52:56 AM
    • wodkode: shut it down or fix it
      August 20, 2017, 10:11:28 PM
    • wodkode: dude i cant goto no links on here from google
      August 20, 2017, 10:11:13 PM
    • Dell: Greetings
      August 20, 2017, 11:56:30 AM

    Author Topic: [317] [PI] Open Interface command  (Read 1133 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,

    Offlinerunescape sucks

    • Member
    • ****
    • Posts: 2,798
    • 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)


    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.                 }


     

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