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

My code doesn't worked need help

Discussion in 'Plugin Help' started by Jules, May 15, 2018.

  1. Jules

    Jules Witch

    Messages:
    53
    GitHub:
    Julooooos
    PHP:
    <?php

    namespace Julooooos\Guerilla;

    use 
    pocketmine\Server;
    use 
    pocketmine\Player;
    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\command\Command;
    use 
    pocketmine\command\CommandSender;
    use 
    pocketmine\scheduler\PluginTask;
    use 
    pocketmine\utils\TextFormat;
    use 
    pocketmine\item\Item;
    use 
    pocketmine\entity\Effect;
    use 
    pocketmine\level\Position;
    use 
    pocketmine\level\Level;
    use 
    pocketmine\utils\Config;
    use 
    pocketmine\math\vector3;
    use 
    pocketmine\level\sound\GhastSound;
    use 
    pocketmine\level\sound\ClickSound;
    use 
    pocketmine\level\sound\AnvilUseSound;

    class 
    Countdown extends PluginTask {
        private 
    $countdown 0;
        public function 
    __construct(Main $plugin) {
            
    parent::__construct($plugin);
            
    class 
    Main extends PluginBase implements Listener {
            

      public function 
    onCommand(CommandSender $senderCommand $commandstring $label, array $args) : bool {

           switch(
    $cmd->getName()){
            
                case 
    "guerilla":
                    if(
    $sender instanceof Player) {
                        if(
    $sender->hasPermission("guerilla.start")){
                          foreach(
    $this->getOwner()->getServer()->getOnlinePlayers() as $player) {
                          foreach(
    $this->getServer()->getLevel("world")->getTime() as $time) {
                          
    $sender->getLevel()->setTime(0);
                          
    $this->getServer()->broadcastMessage("Message")
                        
                        if(
    $time === 20) {
                             
    $player->sendMessage("Message");
                             
    $click = new ClickSound($player);
                             
    $player->getLevel()->addSound($click);
                            }
                        if(
    $time === 40) {
                             
    $player->sendMessage->("Message")                 
                             
    $click = new ClickSound($player);
                             
    $player->getLevel()->addSound($click);
                            }
                        if(
    $time === 60) {
                             
    $player->sendMessage("Message");
                             
    $click = new ClickSound($player);
                             
    $player->getLevel()->addSound($click);
                            }
                        if(
    $time === 80) {
                             
    $player->sendMessage("Message");
                             
    $player->getLevel()->addSound(new AnvilUseSound($pl));
                            }
                        }
                    }
                }
            }
        }
    }
                    
                        
                        
     
  2. Jules

    Jules Witch

    Messages:
    53
    GitHub:
    Julooooos
    Can anyone help me please ?
     
  3. LewBr

    LewBr Zombie

    Messages:
    385
    GitHub:
    lewbr
    Whats the problem? What you think is supposed to do that command?
     
  4. Jules

    Jules Witch

    Messages:
    53
    GitHub:
    Julooooos
    the plugin doesn't work, this is the console error : [36m[19:56:35] [m[31m[Server thread/CRITICAL]: ParseError: "syntax error, unexpected 'if' (T_IF)" (EXCEPTION) in "Mon plugin/src/Julooooos/Guerilla/Main" at line 41[m
     
  5. SalmonDE

    SalmonDE Zombie Pigman

    Messages:
    739
    GitHub:
    SalmonDE
    You're missing a semicolon.
    upload_2018-5-15_21-2-27.png
     
  6. Jules

    Jules Witch

    Messages:
    53
    GitHub:
    Julooooos
  7. LewBr

    LewBr Zombie

    Messages:
    385
    GitHub:
    lewbr
    do not worry, this mistake of forgetting the ; is very frequent in programming, if you have never forgotten one, you can not say that you are a programmer. hehe ;):confused:
     
    HyperxXxHound and Eduardo like this.
  8. Jules

    Jules Witch

    Messages:
    53
    GitHub:
    Julooooos
    ahah thanks x)
     
  9. Atomization

    Atomization Baby Zombie

    Messages:
    120
    GitHub:
    iAtomPlaza
    PHP:

    $this
    ->getServer()->broadcastMessage("Message"//here

    if($time === 40) {
        
    $player->sendMessage->("Message"//here          
        
    $click = new ClickSound($player);
        
    $player->getLevel()->addSound($click);
    }
    missing semicolon " ; "
     
  10. SalmonDE

    SalmonDE Zombie Pigman

    Messages:
    739
    GitHub:
    SalmonDE
    I think you should've read the whole thread. The op was made aware of this roughly a month ago.
     
    EdwardHamHam likes this.
  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.