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

My code doesn't worked need help

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

  1. Jules

    Jules Spider

    Messages:
    9
    GitHub:
    Jules
    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 Spider

    Messages:
    9
    GitHub:
    Jules
    Can anyone help me please ?
     
  3. LewBr

    LewBr Zombie

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

    Jules Spider

    Messages:
    9
    GitHub:
    Jules
    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:
    706
    GitHub:
    SalmonDE
    You're missing a semicolon.
    upload_2018-5-15_21-2-27.png
     
  6. Jules

    Jules Spider

    Messages:
    9
    GitHub:
    Jules
  7. LewBr

    LewBr Zombie

    Messages:
    360
    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 Spider

    Messages:
    9
    GitHub:
    Jules
    ahah thanks x)
     

Share This Page