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

How to repeat a Piece of code as times as i want?

Comments in 'Plugin Development' started by TheKillerTacos, Apr 13, 2016.

  1. Svile
    Offline

    Svile Active Member

    Joined:
    Mar 30, 2015
    Posts:
    239
    Minecraft User:
    svile
    you can'use $event , it doesn't exist.
    use $sender instead and check if is a player before sending the popup example:
    PHP:
    if($sender instanceof /pocketmine/Player){
        
    $sender->sendPopup('Hi');
    }
    applqpak likes this.
  2. CookieSteve
    Offline

    CookieSteve Active Member

    Joined:
    Apr 22, 2014
    Posts:
    132
    Minecraft User:
    iStrqfeChris
    $this->getServer()->getScheduler()->scheduleRepeatingTask(new RepeatTask($this), 20);
    Primus likes this.
  3. xBeastMode
    Offline

    xBeastMode Active Member

    Joined:
    Nov 27, 2015
    Posts:
    292
    Could use that too ^^
    applqpak likes this.
  4. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    Code:
    ---
    #Config File for Popper!
    Times: 10
    ...
    
  5. applqpak
    Offline

    applqpak Active Member Plugin Developer

    Joined:
    Dec 16, 2015
    Posts:
    284
    Plugins:
    1
    Minecraft User:
    applqpak
    Why do that when you could just do a for loop?
  6. xBeastMode
    Offline

    xBeastMode Active Member

    Joined:
    Nov 27, 2015
    Posts:
    292
    That can work. Only if he wants to repeat a code in 1 microsecond use for loop :p
    applqpak likes this.
  7. JackboyPlay
    Offline

    JackboyPlay Active Member

    Joined:
    Apr 25, 2015
    Posts:
    507
    Minecraft User:
    JackboyPlay
    Replace it with $player = $sender or use only $sender
    applqpak likes this.
  8. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    applqpak likes this.

Share This Page

Advertisement