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

Сhange the text sign in the event

Discussion in 'Development' started by Алексей, Feb 14, 2017.

  1. Алексей

    Алексей Silverfish

    Messages:
    22
    GitHub:
    opkiler22789
    Hello, I change the text on the sign possibly through PlayerInteractEvent?
    PHP:
     $sign $event->getPlayer()->getLevel()->getTile($event->getBlock()); 
     
  2. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    You can set a sign's text using $sign->setText(); (source)
     
  3. Jack Noordhuis

    Jack Noordhuis Zombie Pigman Poggit Reviewer

    Messages:
    618
    GitHub:
    JackNoordhuis
    Make sure $sign is an instance of pocketmine\tile\Sign and it's also worth noting that the setText() function has four seperate, oprional parameters for the value of each line.
    PHP:
    /** @var $sign pocketmine\tile\Sign */
    $sign->setText("Line #1 text""Line #2 text""Line #3 text""Line #4 text");
     
    corytortoise likes this.
  4. Алексей

    Алексей Silverfish

    Messages:
    22
    GitHub:
    opkiler22789
    it worked, thank you for answering
     
  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.