Welcome, guest! Please login or register.

    * Shoutbox

    RefreshHistory
    • stCky: Palidinho is your OpenGL (was it OpenGL?) stuff open source anywhere?
      August 16, 2017, 09:07:22 PM
    • Travas:BUILD THE WALL
      August 15, 2017, 09:28:49 PM
    • Travas: i have ass cancer
      August 15, 2017, 09:23:29 PM
    • stCky: what are the fudge are you tryna ask?
      August 15, 2017, 08:21:35 PM
    • bader: what are the rsps community alive ?
      August 15, 2017, 05:46:16 PM
    • bader: yo guys
      August 15, 2017, 05:46:08 PM
    • Spacehost:[link] Updated our thread :)
      August 15, 2017, 09:40:34 AM
    • Adaro: The client is in Download section at Homepage
      August 15, 2017, 01:09:20 AM
    • FaTe_Of_GoDs: where do i get the client?????????????
      August 14, 2017, 05:23:14 PM
    • stCky: can anyone help me? I cant login to the shoutbox
      August 13, 2017, 05:45:15 PM
    • drubrkletern: appeal denied
      August 13, 2017, 02:35:27 PM
    • King_Trout:[link]
      August 13, 2017, 11:17:12 AM
    • Cole1497: no sorry
      August 13, 2017, 10:27:14 AM
    • ayz: yo can anyone explain something to me
      August 13, 2017, 08:08:51 AM
    • coolking12: Hi
      August 13, 2017, 04:16:06 AM
    • stCky: n+1
      August 11, 2017, 06:09:24 PM
    • PalidinoDH: How many more pages are going to show errors before this dude gets on and fixes shit
      August 11, 2017, 04:57:00 PM
    • stCky: it is made by the wonderful people at jetbrains
      August 10, 2017, 10:00:06 PM
    • Zoravon: what's the difference between that and eclipse?
      August 10, 2017, 05:59:52 PM
    • stCky: use an IDE like IntelliJ or shitclipse
      August 10, 2017, 05:33:01 PM

    Author Topic: [317 PI] Adding donator commands [317 PI]  (Read 427 times)

    0 Members and 1 Guest are viewing this topic.

    Offlinealik123

    • Member
    • **
    • Posts: 26
    • Thanks: +0/-0
      • View Profile
    [317 PI] Adding donator commands [317 PI]
    « on: April 08, 2015, 01:51:11 PM »
    What is the basic command for donators?
    I mean for normal players it is:

    Code: [Select]
    if (playerCommand.startsWith("trade") && c.teleBlockLength == 0) {
                c.getPA().startTeleport(2605, 3097, 0, "modern");
                c.sendMessage("You teleport to the trade area.");
            }

    Offlinesk8rdude461

    • MOPARSCAPE WAS HACKED
    • Member
    • ****
    • *
    • Posts: 12,471
    • Thanks: +0/-0
      • View Profile
    Re: [317 PI] Adding donator commands [317 PI]
    « Reply #1 on: April 08, 2015, 03:44:35 PM »
    It would depend on your server and your variable names.

    As I have told you over at least 3 different times over skype, you don't need to be checking the teleBlockLength, that should be done in the teleport code.

    You also need to understand what each of the following methods do:
    Code: Java
    1. startsWith(String s)
    2. equals(String s)
    3. equalsIngoreCase(String s)
    4. endsWith(String s)
    5. contains(CharSequence s)
    http://docs.oracle.com/javase/7/docs/api/java/lang/String.html

    With your current code, the command expects the word to be longer than "trade". It expects that there will be something after the word. It doesn't expect anything specific, but it does expect something. So a space, a number, a letter, literally anything.

    If your donators have the boolean 'isDonator' set to true in their accounts, then you could do something like:
    Code: Java
    1. if(playerCommand.equalsIgnoreCase("trade")&& c.isDonator){
    2.             c.getPA().startTeleport(2605, 3097, 0, "modern");
    3.             c.sendMessage("You teleport to the trade area.");
    4.         }

    and then only players with "isDonator" set to true will be able to use the trade command.

     

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