Kit Task

Discussion in 'Plugin Help' started by PixelzChris, Apr 30, 2019.

  1. PixelzChris

    PixelzChris Silverfish

    Messages:
    15
    ```if ($item->getName() == "BRUH"){
    if ($player->hasPermission("kit.youtube")){
    if(!isset($this->cooldown[$player->getName()])) $this->cooldown[$player->getName()] = 0;
    if($this->cooldown[$player->getName()] <= time()){
    //use
    $this->cooldown[$player->getName()] = time() + 7200;
    $item = \pocketmine\item\Item::get(54, 0, 1);
    $item->setCustomName(C::BOLD . "Kit " . C::WHITE . "You" . C::RED . "Tube ");
    $item->setLore(["Place to activate"]);
    $player->getInventory()->addItem($item);
    $player->sendMessage("[You" . C::RED . "Tube" . C::WHITE . " Kit]" . C::GREEN . " Your Youtube kit has arrived!");
    $player->getLevel()->addSound(new AnvilUseSound(new Vector3($player->getX(), $player->getY(), $player->getZ())));
    } else {
    $player->sendMessage(C::RED . "You cant use this kit now!");
    $player->getLevel()->addSound(new AnvilFallSound(new Vector3($player->getX(), $player->getY(), $player->getZ())));
    $this->openFreeKits($player);
    }
    }else{
    $player->sendMessage("[You" . C::RED . "Tube" . C::WHITE . " Kit]" . C::RED . " You dont have permission to use this kit.");
    $player->getLevel()->addSound(new AnvilFallSound(new Vector3($player->getX(), $player->getY(), $player->getZ())));
    $this->openFreeKits($player);
    }
    }```

    I want every time I use a kit once thethe second time it will give me a message like "You can use the kit in" . "$timeleft"
    So I can get the time left... the current code now is You cant use this kit now!
     
  2. JORDAN SAUNDERS

    JORDAN SAUNDERS Silverfish

    Messages:
    19
    GitHub:
    brunswickyt
    Take a look at kit ui or custom kits on poggit.. They should help you alot :)
     
  3. Levi

    Levi Skeleton

    Messages:
    846
    GitHub:
    captainleviftw
    Compare the time when they claimed the kit and the current time
     

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.