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

not determined nick in function

Comments in 'Plugin Development' started by BlackJIeB, Jul 22, 2015.

  1. BlackJIeB
    Offline

    BlackJIeB New Member

    Joined:
    Oct 12, 2014
    Posts:
    28
    Minecraft User:
    BlackJIeB
    PHP:
        public function BasicItemGive() {
            foreach (
    $this->getServer()->getOnlinePlayers() as $p) {
                if (
    $p->getPlayer()->getNameTag() == (F::GOLD F::BOLD "Basic | " F::RESET F::BOLD $p->getPlayer()->getDisplayName())) {
                    
    $p->getPlayer()->getInventory()->setHelmet(Item::get(29801));
                    
    $p->getPlayer()->getInventory()->setChestplate(Item::get(30301));
                    
    $p->getPlayer()->getInventory()->setLeggings(Item::get(30001));
                    
    $p->getPlayer()->getInventory()->setBoots(Item::get(30101));
                    
    $p->getPlayer()->getInventory()->sendArmorContents($player);
                    
    $p->getPlayer()->getInventory()->addItem(Item::get(27201));
                    
    $p->getPlayer()->getInventory()->addItem(Item::get(35101));
                } else {
                    
    $p->getPlayer()->sendMessage("nihuya ne rabotaet");
                }
            }
        }
    "if ($p->getPlayer()->getNameTag() == (F::GOLD . F::BOLD . "Basic | " . F::RESET . F::BOLD . $p->getPlayer()->getDisplayName())) {" - does not define nickname player.

    What's wrong?
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Why $p->getPlayer()...
    MCPEPIG likes this.
  3. BlackJIeB
    Offline

    BlackJIeB New Member

    Joined:
    Oct 12, 2014
    Posts:
    28
    Minecraft User:
    BlackJIeB
    Fixed, but to no avail:

    Code:
        public function BasicItemGive() {
            foreach ($this->getServer()->getOnlinePlayers() as $p) {
                if ($p->getNameTag() == (F::GOLD . F::BOLD . "Basic | " . F::RESET . F::BOLD . $p->getDisplayName())) {
                    $p->getInventory()->setHelmet(Item::get(298, 0, 1));
                    $p->getInventory()->setChestplate(Item::get(303, 0, 1));
                    $p->getInventory()->setLeggings(Item::get(300, 0, 1));
                    $p->getInventory()->setBoots(Item::get(301, 0, 1));
                    $p->getInventory()->sendArmorContents($player);
                    $p->getInventory()->addItem(Item::get(272, 0, 1));
                    $p->getInventory()->addItem(Item::get(351, 0, 1));
                } else {
                    $p->sendMessage("nihuya ne rabotaet");
                    $p->sendMessage($p->getPlayer()->getNameTag()." vot tak");
                }
            }
        }
    function, by the way, is through $this->BasicItemGive();
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    So nothing happens at all?
  5. BlackJIeB
    Offline

    BlackJIeB New Member

    Joined:
    Oct 12, 2014
    Posts:
    28
    Minecraft User:
    BlackJIeB
    not quite, gives message "nihuya ne rabotaet"
  6. TryoneLegendZzz
    Offline

    TryoneLegendZzz Active Member

    Joined:
    May 31, 2015
    Posts:
    201
    Minecraft User:
    SavionLegendZzz
    try putting:
    PHP:
    public function BasicItemGive($player) {
  7. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    No. I think he should replace $player with $p.
  8. TryoneLegendZzz
    Offline

    TryoneLegendZzz Active Member

    Joined:
    May 31, 2015
    Posts:
    201
    Minecraft User:
    SavionLegendZzz
    on
    setArmorContent?
    PEMapModder likes this.

Share This Page

Advertisement