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

Error code

Discussion in 'Development' started by Flupko, Oct 16, 2018.

  1. Flupko

    Flupko Silverfish

    Messages:
    24
    GitHub:
    Warex
    I have an error in my code but I do not understand why. Can you help me ?
    Error :
    HTML:
    [Server thread/CRITICAL]: ParseError: "syntax error, unexpected ';', expecting ',' or ')'" (EXCEPTION) in "GunCore v17/src/GunCore/Main" at line 515
    
    Code :
    PHP:
            public function boss(Position $spawnPos)  {
                
    $animalId Entity::ZOMBIE;
                
    $entity Entity::createEntity($animalId$spawnPos->getLevel(), Entity::createNBT($spawnPos);
                
    $entity->setMaxHealth(500);
                
    $entity->setHealth(500);
                
    $entity->setScale(5);
                
    $entity->setNameTag("§8<§aTITAN§8>");
                
    $entity->spawnToAll();
             }
     
  2. shabzz102

    shabzz102 Spider

    Messages:
    9
    GitHub:
    shabzz102
    Try this.
    PHP:
    $entity Entity::createEntity(Entity::ZOMBIE$this->getServer()->getLevelByName("spawn"), $nbt);
     
  3. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    $nbt isn't defined there?

    You forgot a ) after $spawnPos. You have an opening ( after createEntity, but no closing one for it, so you should have two closing ) at the end of that line, like this:
    PHP:
     $entity Entity::createEntity($animalId$spawnPos->getLevel(), Entity::createNBT($spawnPos));
    I'd suggest learning a bit more about syntax if you see more errors like that. It makes things difficult later on otherwise.
     
    Flupko 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.