1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Help me with this please.

Discussion in 'Plugin Help' started by Mr.Business, Apr 21, 2020.

  1. Mr.Business

    Mr.Business Spider

    Messages:
    7
    GitHub:
    xslimex
    $this->getServer()->dispatchCommand(new \pocketmine\command\ConsoleCommandSender(), "setuperm " . $player->getName() . "Test.kit");

    Guys can anyone tell me what's wrong here?
    I just get an error on the getServer()
     
  2. QuiverlyRivalry

    QuiverlyRivalry Zombie Pigman

    Messages:
    491
    GitHub:
    quiverlyrivalry
    Post error? also replace "Test.kit" to " Test.kit"
     
  3. lunix

    lunix Spider

    Messages:
    8
    Please use code blocks when posting code.

    As @QuiverlyRivalry said, it is important to show us the error. That way we can actually understand what your problem is.

    Anyways, you are missing a space between the player name and "Test.kit". Example fix:
    PHP:
    $this->getServer()->dispatchCommand(new \pocketmine\command\ConsoleCommandSender(), "setuperm {$player->getName()} Test.kit");
     
  4. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    How has no one mentioned the biggest issue of all: That code is awfully bad practise, you should access the PurePerms API directly instead of executing a command.
     
    ethaniccc likes this.
  5. Mr.Business

    Mr.Business Spider

    Messages:
    7
    GitHub:
    xslimex
    Thanks for the help but now I'm having this error with your code:

    [11:29:23] [Server thread/CRITICAL]: ParseError: "syntax error, unexpected '"', expecting ')'" (EXCEPTION)
     
  6. lunix

    lunix Spider

    Messages:
    8
    Please post the code if you show an error message.

    I don't know what plugin you are using, but as @HimbeersaftLP pointed out, it seems to be PurePerms. If it has an API, please use that directly. (@HimbeersaftLP seems to know the plugin, so he might be able to tell you about the API.)
     
  7. Mohagames205

    Mohagames205 Spider Jockey

    Messages:
    26
    GitHub:
    mohagames205
    HimbeersaftLP and ethaniccc like this.
  8. Mr.Business

    Mr.Business Spider

    Messages:
    7
    GitHub:
    xslimex
  9. Mr.Business

    Mr.Business Spider

    Messages:
    7
    GitHub:
    xslimex
    I see you know about pp,can you help me make a online staff gui?
    Like if you type /staff it opens a GUI with the online staff members according to the groups they have.
     
  10. lunix

    lunix Spider

    Messages:
    8
    I checked out the plugin and it is really easy to get the online players of a certain group:
    PHP:
    $purePerms $this->getServer()->getPluginManager()->getPlugin('PurePerms');

    /** @var pocketmine\Player[] $admins */
    $admins = [];
    if (
    $purePerms) {
        
    $adminGroup $purePerms->getGroup('Admin'); // replace 'Admin' with the desired group name

        
    if ($adminGroup) {
            
    $admins $purePerms->getOnlinePlayersInGroup($adminGroup);
        }
    }

    // do something with $admins
     
    QuiverlyRivalry likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.