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

I need another plugin help!

Discussion in 'General discussion' started by Zarooz, Dec 31, 2019.

  1. Zarooz

    Zarooz Spider

    Messages:
    10
    So far I have this plugin where when players join they get teleported to the default world:

    public function onJoin(PlayerJoinEvent $joinEvent) {
    $joinEvent->getPlayer()->teleport($joinEvent>getPlayer()->getServer()->getDefaultLevel()->getSafeSpawn()); }

    - How would make it so instead of a default level they get teleported to a level of my choice?
     
  2. Mr174

    Mr174 Baby Zombie

    Messages:
    187
    GitHub:
    mr174
    PHP:
    $p->teleport($this->plugin->getServer()->getLevelByName'levelnamehere')->getSpawnLocation());
    $p = $ev->getPlayer(); btw
    ALSO MAKE SURE THE WORLD IS LOADED
     
    Gilsheys likes this.
  3. Zarooz

    Zarooz Spider

    Messages:
    10
    what is $ev and what pocketmine class would i use for this
     
  4. Mr174

    Mr174 Baby Zombie

    Messages:
    187
    GitHub:
    mr174
    $ev is $joinEvent
    and in the onJoin Thats what you asked for....
     
  5. Zarooz

    Zarooz Spider

    Messages:
    10
    Server thread/CRITICAL ErrorException: "Undefined property: SaltyBunnyRR1\shadow_ce\Main::$plugin"
     
  6. Mr174

    Mr174 Baby Zombie

    Messages:
    187
    GitHub:
    mr174
    Send the line of code please
     
  7. Zarooz

    Zarooz Spider

    Messages:
    10
    public function onJoin(PlayerJoinEvent $joinEvent) {
    $p = $joinEvent->getPlayer();
    $p->teleport($this->plugin->getServer()->getLevelByName( 'Hub')->getSpawnLocation());
     
  8. ZackyVN

    ZackyVN Baby Zombie

    Messages:
    150
    change
    $p->teleport($this->plugin->getServer()->getLevelByName( 'Hub')->getSpawnLocation());[/QUOTE]
    to
    $p->teleport($this->getServer()->getLevelByName( 'Hub')->getSpawnLocation());[/QUOTE]
     
    Mr174 likes this.
  9. Mr174

    Mr174 Baby Zombie

    Messages:
    187
    GitHub:
    mr174
    to
    $p->teleport($this->getServer()->getLevelByName( 'Hub')->getSpawnLocation());[/QUOTE][/QUOTE]
    Whoops my bad lol im so used to $this->plugin-> Lol
     
  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.