Alternative for isOP()

Discussion in 'Help' started by Luigyo, Jul 8, 2022.

  1. Luigyo

    Luigyo Creeper

    Messages:
    3
    hello guys, so i want to send Players ( Only Ops) an message on Join. Sadly isop() doesnt work anymore so does anyone has an alternative? Im really struggling
     
  2. SVega

    SVega Spider

    Messages:
    13
    GitHub:
    svega9848
    You can still do it that way. Just use $this->getServer()->isOp("playername");

    It could be like this.

    public function onJoin(PlayerJoinEvent $event) {
    $player = $event->getPlayer();
    $event->setJoinMessage("");
    if($this->getServer()->isOp("playername")) {
    $player->sendMessage("You're an operator!! This is your customized join message");
    }
    }
     
  3. Luigyo

    Luigyo Creeper

    Messages:
    3
    if($this->getServer()->isOp("playername")) {

    i ddont understand how this line gets the player, playername must be changed iinto something else or not
     
  4. SVega

    SVega Spider

    Messages:
    13
    GitHub:
    svega9848
    Nono. With this function the server looks for the playername in the op list, so you just have to put in there the variable that contains the playername. This changed since PMMP started using API 4.0.0 instead of 3.0.0

    I will do an example for you, wait
     
  5. SVega

    SVega Spider

    Messages:
    13
    GitHub:
    svega9848
    Here it is. Check the main php and test the plugin as you like. If you have more questions, you can add me in Discord SVega#6683
     

    Attached Files:

Share This Page

  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.