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

How do I do this?

Discussion in 'Development' started by JoshXX, Feb 25, 2017.

  1. JoshXX

    JoshXX Spider

    Messages:
    14
    PHP:
    case "rpg":
            switch(
    strtolower($args[0])) {
              case 
    "class":
              switch(
    strtolower($args[1])) {
              case 
    "mage":
                if(
    $this->getOwner()->hasClass($p)){
                  
    $p->sendMessage(TF:: RED "You have already chosen a class young mage!");
                } else {
                  
    $p->setGroup->("Mage");
                  
    $p->sendMessage(TF:: GREEN "You have chosen to be a powerful mage!");
    As you can see in my rpg plugin, I used $p->setGroup->("Mage") because I want the player's($p) group to be set to Mage but I don't know how to make this plugin use/run code(setGroup) associated with another plugin(PurePerms)

    I'm a noob I know :facepalm:
     
  2. Marabou

    Marabou Baby Zombie

    Messages:
    137
    GitHub:
    wiligangster
    use break;
     
  3. JoshXX

    JoshXX Spider

    Messages:
    14
    That's not what I needed help with :facepalm:
     
  4. JoshXX

    JoshXX Spider

    Messages:
    14
    @Muqsit Could you maybe help please
     
  5. kaliiks

    kaliiks Zombie

    Messages:
    250
    Function setGroup is not implemented in pm. so create your own function
     
  6. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    PHP:

    private $pureperms;
    public function 
    onEnable(){
        
    $this->pureperms $this->getServer()->getPluginManager()->getPlugin('PurePerms');
    }

    //.......................................
    case "rpg":
            switch(
    strtolower($args[0])) {
              case 
    "class":
              switch(
    strtolower($args[1])) {
              case 
    "mage":
                if(
    $this->getOwner()->hasClass($p)){
                  
    $p->sendMessage(TF:: RED "You have already chosen a class young mage!");
                } else {
                  
    $group $this->pureperms->getGroup("Mage");
                  
    $this->pureperms->setGroup($p$group);
                  
    $p->sendMessage(TF:: GREEN "You have chosen to be a powerful mage!");
     
    corytortoise and JoshXX like this.
  7. JoshXX

    JoshXX Spider

    Messages:
    14
    Thank you :)
     
  8. Jack Noordhuis

    Jack Noordhuis Zombie Pigman Poggit Reviewer

    Messages:
    618
    GitHub:
    JackNoordhuis
    Note: This will only work if you have the pureperms plugin loaded on your server and there should be some basic checks done on the pureperms property to ensure no errors are thrown.
     
    Muqsit and corytortoise like this.
  9. jasonwynn10

    jasonwynn10 Moderator Poggit Reviewer

    Messages:
    1,489
    GitHub:
    jasonwynn10
    make sure to add this to your config:
    Code:
    depend: PureChat
     
  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.