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

Unexpected “)” syntax error, but there isnt a way I can fix that the syntax is right.

Discussion in 'Development' started by Remarkabless, Nov 3, 2017.

  1. Remarkabless

    Remarkabless Slime

    Messages:
    83
    GitHub:
    Remakem
    PHP:
        public function onDeath(EntityDamageEvent $event) {
            
    $player $event->getEntity();
            
    $killer $event->getFinalDamage()->getDamager();
            
    $killern $killer->getEntity();
                if(
    $event instanceof Player){
                    
    $killer->sendMessage(c::RED" You killed "$player . );
        }
    }
     
  2. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Remove the last dot in sendMessage(). A string can be concatenated with
    • an object with method __toString() declared
    • another string
    • null
    • float|int|double
    but never with the open atmosphere. You never know what's happening in the atmosphere.
     
  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.