Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

shop for skywars

Comments in 'Plugin Development' started by GamesLoad, Jun 14, 2015.

  1. GamesLoad
    Offline

    GamesLoad Active Member

    Joined:
    Jun 28, 2014
    Posts:
    106
    Minecraft User:
    GamesLoad
    Hello I wanted to know how he can make sure that you are a player type / sw shop must be that it is in one of the worlds skywars arena does not otherwise command executes
    this is my code
    PHP:
        if (strtolower $args [0] ) == "shop") {
                        if (! (
    $sender instanceof Player)) {
                            
    $output .= "Please run this command in-game.\n";
                            
    $sender->sendMessage $output );
                            return;
                        }
                            
    $worldarena =  array("skywars1" "skywars2" "skywars3" "skywars4" "skywars5" );
                        if() { }
                        else {
                              
    $sender->sendMessage("[SkyWars] you must be in a skywars world to execute this command");
                        }
    return;
    }
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Depends on your definition of SkyWars worlds. How would we know that??

    If it is an array of strings containing world names, use in_array.
  3. GamesLoad
    Offline

    GamesLoad Active Member

    Joined:
    Jun 28, 2014
    Posts:
    106
    Minecraft User:
    GamesLoad
    skywars the worlds are worlds where you play the then suffered when the player is in one of those worlds to say that playing the game
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    I mean, how can we know if it is a skyward world from the code?
  5. GamesLoad
    Offline

    GamesLoad Active Member

    Joined:
    Jun 28, 2014
    Posts:
    106
    Minecraft User:
    GamesLoad
    I'll tell you there is an array with a list of worlds that are to play skywars
    if the player is in the world then he will execute the command breasts will not be able to run it.
  6. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    1. Punctuations please. It is very difficult to read without punctuations.
    2. Is your array a string stay? If yes, in_array($player->getLevel()->getName(), $array).
  7. GamesLoad
    Offline

    GamesLoad Active Member

    Joined:
    Jun 28, 2014
    Posts:
    106
    Minecraft User:
    GamesLoad
    Sorry but I do not know English well. Thank you

Share This Page

Advertisement