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

unexpected 'public' (T_PUBLIC)

Discussion in 'Facepalm' started by armagadon159753, Jun 11, 2017.

  1. armagadon159753

    armagadon159753 Zombie

    Messages:
    217
    GitHub:
    armagadon159753
  2. HBIDamian

    HBIDamian HBIDamian Staff Member

    Messages:
    365
    GitHub:
    HBIDamian
    Hey. Could you please show me the console error messages?

    (If I had my laptop, I could solve it, but right now I’m using my phone.)
     
  3. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    Please keep in mind that this section is for PMMP API related not PHP related question,
    also dont "just say "can you give me code" without making any effort to solve your own problem first."
    if you are having issues with syntax errors i highly recommend you to use an IDE to assist you, or these PHP checker websites but i recommend not to since sometimes it can get very unhelpful
    if you wish to post this kind of questions you are recommended to post it in facepalm section... to get more appropriate respond
     
    jasonwynn10 and HBIDamian like this.
  4. armagadon159753

    armagadon159753 Zombie

    Messages:
    217
    GitHub:
    armagadon159753
    [QUOTE = "Thunder33345, poste: 27911, membre: 15"] N'oubliez pas que cette section concerne l'API PMMP non traitée par PHP,
    Aussi ne "disent simplement" pouvez-vous me donner un code "sans faire aucun effort pour résoudre votre propre problème d'abord."
    Si vous rencontrez des problèmes avec des erreurs de syntaxe, je vous recommande vivement d'utiliser un IDE pour vous aider, ou ces sites Web de vérificateurs PHP, mais je vous le recommande, car parfois il peut être très peu utile
    Si vous souhaitez publier ce genre de questions, vous êtes recommandé de l'afficher dans la section facepalm ... pour obtenir une réponse plus appropriée [/ QUOTE]
    I have already passed this stage. I used php code checker pulse
     
  5. armagadon159753

    armagadon159753 Zombie

    Messages:
    217
    GitHub:
    armagadon159753
    [QUOTE = "TheDeibo, poste: 27910, membre: 11"] Hé. Pourriez-vous me montrer les messages d'erreur de la console?

    (Si j'avais mon ordinateur portable, je pourrais le résoudre, mais maintenant j'utilise mon téléphone.) [/ QUOTE]

    Merci quand même
     

    Attached Files:

  6. HBIDamian

    HBIDamian HBIDamian Staff Member

    Messages:
    365
    GitHub:
    HBIDamian
    Hi. This forum is a English Forum. Try keep it that way :).

    I believe your issue is the
    PHP:
    public function onInteract(PlayerInteractEvent $event){
    $player $event->getPlayer();
    $item $event->getItem();

    //Inventory
    if($item->getCustomName() == "inventory"){
    $player->getInventory()->clearAll();
    $player->getInventory()->setItem(Item::get(329)->setCustomName("gadgets"));
    }

    //Gadgets
    if($item->getCustomName() == "gadgets"){
    $player->getInventory()->clearAll();
    $player->getInventory()->setItem(Item::get(280)->setCustomName("tntthrower"));

    if(
    $item->getCustomName() == "tntthrower"){
    $nbt = new CompoundTag"", [ 
                    
    "Pos" => new ListTag
                    
    "Pos", [ 
                        new 
    DoubleTag(""$player->x),
                        new 
    DoubleTag(""$player->y+$player->getEyeHeight()),
                        new 
    DoubleTag(""$player->z
                    ]),
                    
    "Motion" => new ListTag("Motion", [ 
                            new 
    DoubleTag("", -\sin ($player->yaw 180 M_PI) *\cos ($player->pitch 180 M_PI)),
                            new 
    DoubleTag ("", -\sin ($player->pitch 180 M_PI)),
                            new 
    DoubleTag("",\cos ($player->yaw 180 M_PI) *\cos $player->pitch 180 M_PI)) 
                    ] ),
                    
    "Rotation" => new ListTag("Rotation", [ 
                            new 
    FloatTag(""$player->yaw),
                            new 
    FloatTag(""$player->pitch
                    ] ) 
            ] );
           
           
            
    $f 3.0;
            
    $snowball Entity::createEntity("PrimedTNT"$player->getlevel(), $nbt$player);
            
    $snowball->setMotion($snowball->getMotion()->multiply($f));
            
    $snowball->spawnToAll();

    }
    Please make sure the syntax, and all ending of any if statements are correct. If you use a IDE (or a text editor that supports PHP) it will tell you where you went wrong. It will also highlight corresponding brackets.
     
    jasonwynn10 and armagadon159753 like this.
  7. armagadon159753

    armagadon159753 Zombie

    Messages:
    217
    GitHub:
    armagadon159753
    The syntaxe error is on public function onDamage :(
     
  8. HBIDamian

    HBIDamian HBIDamian Staff Member

    Messages:
    365
    GitHub:
    HBIDamian
    There is nothing wrong with onDamage. So, the issue must me in the onInteract.
     
  9. armagadon159753

    armagadon159753 Zombie

    Messages:
    217
    GitHub:
    armagadon159753
    Maybe on $nbt ?
     
  10. SergeyIvanov

    SergeyIvanov Witch

    Messages:
    59
    GitHub:
    sergeyivanov14
    Add two } in end of playerinteract
     
    HBIDamian, jasonwynn10 and Sandertv like 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.