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

Cooldown

Discussion in 'Development' started by Remarkabless, Dec 10, 2017.

  1. Remarkabless

    Remarkabless Slime

    Messages:
    83
    GitHub:
    Remakem
    can someone help me finish this, I simply just want to make a cooldown when someone uses an item. This is the farthest I got. I tried and yes there is other threads. I find them too hard and more advanced whn I simply want to create a simple cooldown.

    PHP:
                    case Item::FEATHER:
                    
    $player->addEffect(Effect::getEffect(Effect::JUMP)->setAmplifier(1)->setDuration(20 8));
                    
    $this->addToCoolDown($name);
                    break;
                } 
        }
       
        public function 
    addToCoolDown(Player $playerItem $item) {
        }
       
     
  2. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    you need to do $this->addToCooldown($player,$item) not $name, as the hintypes

    you need 2 methods btw, one add one check
    the add method will set an array $this->$cooldowns[$name] = time()+"insert cooldown time", the check method will see if time() is > cooldown time
     
  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.