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

Crate Plugin - My First EVER plugin

Discussion in 'Development' started by Lqchlan, Jul 14, 2017.

  1. Lqchlan

    Lqchlan Creeper

    Messages:
    3
    GitHub:
    Lqchlan
    IMG_2607.JPG Hello, I've made a start on a Crate plugin at the moment I'm working on the recievement of a crate key.
    Questions)
    How to use the items add id setup?
    How to name a custom item?
    And how to use a $ parentheses that will be dependent on what argument is stated in the comman eg. /Crate common (gives common key) /crate rare etc.
     
  2. xZeroMCPE

    xZeroMCPE Witch

    Messages:
    67
    GitHub:
    xZeroMCPE
    K
     
  3. HBIDamian

    HBIDamian HBIDamian Staff Member

    Messages:
    365
    GitHub:
    HBIDamian
    Hello. I see you are using a online tool for php, but why don’t you use a text editor or IDE?

    I suggest brackets.io. That is what I use, and it formats the code so it’s easier to understand (by the colour of the code)
    Alternatively, use Notepad++
     
  4. Lqchlan

    Lqchlan Creeper

    Messages:
    3
    GitHub:
    Lqchlan
    Funny enough I am using notepad++. Those pictures were when I was trying to test it on a server.pro thing, I couldn't find the latest pocketmine version to test it on, so I alternatively used a cheap option. but I'll have a look at upgrading to brackets.io.

    Cheers,
     
  5. Teamblocket

    Teamblocket Zombie

    Messages:
    301
    GitHub:
    teamblocket
    PHP:
    $item Item::get(Iddamagecount);
    $player->getInventory()->addItem($item);
    One Line
    $player
    ->getInventory()->addItem(Item::get(IdDamageCount));

    $item Item::get(Iddamagecount);
    $item->setCustomName("string");
    $player->getInventory()->addItem($item);
    One Line
    $player
    ->getInventory()->addItem(Item::get(Iddamagecount)->setCustomName("string"));
    :D
    just incase your new to the PMMP API https://github.com/pmmp/PocketMine-MP/blob/master/src/pocketmine/item/Item.php

    also remember to add \pocketmine\item\Item
     
  6. Lqchlan

    Lqchlan Creeper

    Messages:
    3
    GitHub:
    Lqchlan
    And afterwards I can use $item and in game it should display as the custom name?
     
  7. Teamblocket

    Teamblocket Zombie

    Messages:
    301
    GitHub:
    teamblocket
    the item will not display the customname until you add the custom name
     
  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.