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

PlayerGiveSelf Plugin Help!

Comments in 'Plugin Development' started by NIM, Dec 26, 2013.

  1. NIM
    Offline

    NIM Active Member

    Joined:
    Nov 28, 2013
    Posts:
    74
    Minecraft User:
    NIMGamingPRO
    I am currently working on a plugin which will let non oped users easily get armor, food, and swords without having to ask for it, I will be using this for a PvP server and I decided to share it with you guys, can anyone help me? this is what I have so far:

    PHP:
    <?php

    /*
    _PocketMine Plugin_
    name=PlayerGiveSelf
    descrption= Player can give himself certain food, armor, and weapons by using commands
    version=1.0
    author=NIM
    class=give
    apiversion=11
    */


    class give implements Plugin{
      private 
    $api;
      public function 
    __construct(ServerAPI $api$server false){
    $this->api $api;

    }

    public function 
    init(){
    $this->api->console->register("sword","gives a stone sword to that user",array($this"sword"));
      
    $this->api->console->register("food","gives a potato to that user",array($this"food"));
      
    $this->api->console->register("armor","gives chain boots to that user",array($this"armor"));
    }

     
    public function 
    sword($cmd$params$issuer$alias$args$issuer){
      
    $this->api->console->run("give " $issuer->username " 272 1");
      
    $issuer->sendChat("[Server] You Have Recieved a Sword!");
      }

    public function 
    food($cmd$params$issuer$alias$args$issuer){
      
    $this->api->console->run("give " $issuer->username " 392 5");
      
    $issuer->sendChat("[Server] You Have Recieved Food!");
      }

      public function 
    armor($cmd$params$issuer$alias$args$issuer){
      
    $this->api->console->run("give " $issuer->username " 305 1");
      
    $issuer->sendChat("[Server] You Have Recieved Armor!");
      }

    }
    Last edited: Dec 27, 2013
  2. MegaMe
    Offline

    MegaMe New Member

    Joined:
    Dec 16, 2013
    Posts:
    8
    Minecraft User:
    McPe213
    $this->api->console->register("food","gives a potatoe to that user",array($this, "give"));

    You spelt potato wrong.
  3. JassperBeastHD
    Offline

    JassperBeastHD Banned

    Joined:
    Aug 27, 2013
    Posts:
    436
    Minecraft User:
    JassperBeastHD
    That doesnt do anything -_-
  4. LDX
    Offline

    LDX Notable Member Plugin Developer

    Joined:
    Oct 2, 2013
    Posts:
    1,434
    Plugins:
    14
    You forgot to add the line "public function __destruct() {}" right before init().
  5. JassperBeastHD
    Offline

    JassperBeastHD Banned

    Joined:
    Aug 27, 2013
    Posts:
    436
    Minecraft User:
    JassperBeastHD
    You dont need $isser->username just put $issuer ;)
  6. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,710
    Plugins:
    22
    Minecraft User:
    Falkirknh
    I think you need the username to run the command.
    LDX likes this.
  7. JassperBeastHD
    Offline

    JassperBeastHD Banned

    Joined:
    Aug 27, 2013
    Posts:
    436
    Minecraft User:
    JassperBeastHD
    It can be this:
    PHP:
    $this->api->console->run("give " $issuer " 276");
    $issuer->sendChat("FART");
  8. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,710
    Plugins:
    22
    Minecraft User:
    Falkirknh
    Really? I didn't know :)
  9. _XxBeastxX_
    Offline

    _XxBeastxX_ Banned

    Joined:
    Nov 21, 2013
    Posts:
    2
    Minecraft User:
    Butt
    why is he banned?
  10. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,710
    Plugins:
    22
    Minecraft User:
    Falkirknh
    You are banned for using an alt account ^^^ to interact with your main account. Actions included: following the main and bumping the main accounts threads.
    I suggest you wait for the ban to expire if you don't want it extended for ban evasion :)
    Further use of your sock will result in its perm banning.
    LDX likes this.
  11. _XxBeastxX_
    Offline

    _XxBeastxX_ Banned

    Joined:
    Nov 21, 2013
    Posts:
    2
    Minecraft User:
    Butt
    delete this account plz so i wont get perm banned
  12. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,710
    Plugins:
    22
    Minecraft User:
    Falkirknh
    Your fine with the account just don't use it to evade bans or interact with your other account.
  13. LDX
    Offline

    LDX Notable Member Plugin Developer

    Joined:
    Oct 2, 2013
    Posts:
    1,434
    Plugins:
    14
    That was an interesting twist. o_O
    Falk likes this.

Share This Page

Advertisement