Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

FIXED

Comments in 'Plugin Development' started by JassperBeastHD, Nov 12, 2013.

  1. JassperBeastHD
    Offline

    JassperBeastHD Banned

    Joined:
    Aug 27, 2013
    Posts:
    436
    Minecraft User:
    JassperBeastHD
    The data stuff work but the message dint work lol
  2. TrilogiForce
    Offline

    TrilogiForce Ban Evader Banned

    Joined:
    Sep 7, 2013
    Posts:
    228
    Minecraft User:
    TrilogiForce
    ITS THE
    PHP:
    $issuer->sendChat
    !!!!
    that crash the server|plugin use this thing:
    PHP:
    $output .= 'TEXT HERE!'';
    return $output;
  3. JassperBeastHD
    Offline

    JassperBeastHD Banned

    Joined:
    Aug 27, 2013
    Posts:
    436
    Minecraft User:
    JassperBeastHD
    Sure and thx ill try )
  4. JassperBeastHD
    Offline

    JassperBeastHD Banned

    Joined:
    Aug 27, 2013
    Posts:
    436
    Minecraft User:
    JassperBeastHD
    Like this:
    PHP:
    <?php
    /*
    __PocketMine Plugin__
    name=JoinMessage
    version=1.0.0-BETA
    author=JassperBeastHD
    class=message
    apiversion=10
    */
    class message implements Plugin
    {
    private 
    $api;
    public function 
    __construct(ServerAPI $api$server false)
    {
    $this->api $api;
    }
    public function 
    init()
    {
    $this->api->addHandler("player.join", array($this"handler"), 5);
    $this->api->addHandler("player.respawn", array($this"handler"), 5);
    }
    public function 
    __destruct(){
    }
    public function 
    handler($event$data){
    $player $data;
    switch(
    $event){
    case 
    "player.join":
    $output .='====[SBP Server]====\nWelcome @player to SBP Server\n-Owner=XxSilentBeastxX_\n-Youtube=XxSilentBeastGamerxX\n-Co-Owner=JassperBeastHD\n-Youtube=JassperBeastHD\n====[SBP Server]====\n'
    return $output;
    break;
    case 
    "player.respawn":
    $output .='====[Death Message]====\n-You died\n-To bad you lose your stuff\n-Make sure to get your stuff back\n====[Death Message]====\n';
    return 
    $output;
    break;
    }
    }
    }
  5. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,706
    Plugins:
    22
    Minecraft User:
    Falkirknh
    Hmmm...I don't see why that would make any difference.
  6. JassperBeastHD
    Offline

    JassperBeastHD Banned

    Joined:
    Aug 27, 2013
    Posts:
    436
    Minecraft User:
    JassperBeastHD
    DOESNT WORK!
  7. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,706
    Plugins:
    22
    Minecraft User:
    Falkirknh
    Could you post what your using, I'm sorry it's taking so long :(
  8. JassperBeastHD
    Offline

    JassperBeastHD Banned

    Joined:
    Aug 27, 2013
    Posts:
    436
    Minecraft User:
    JassperBeastHD
    0.0 what?
  9. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,706
    Plugins:
    22
    Minecraft User:
    Falkirknh
    Post the exact code your using, I assume you changed it from mine since mine was wrong
  10. JassperBeastHD
    Offline

    JassperBeastHD Banned

    Joined:
    Aug 27, 2013
    Posts:
    436
    Minecraft User:
    JassperBeastHD
    PHP:
    <?php
    /*
    __PocketMine Plugin__
    name=JoinMessage
    version=1.0.0-BETA
    author=JassperBeastHD
    class=message
    apiversion=10
    */
    class message implements Plugin
    {
    private 
    $api;
    public function 
    __construct(ServerAPI $api$server false)
    {
    $this->api $api;
    }
    public function 
    init()
    {
    $this->api->addHandler("player.join", array($this"handler"), 5);
    $this->api->addHandler("player.respawn", array($this"handler"), 5);
    }
    public function 
    __destruct(){
    }
    public function 
    handler($event$data){
    $player $data;
    switch(
    $event){
    case 
    "player.join":
    $output .='====[SBP Server]====\nWelcome @player to SBP Server\n-Owner=XxSilentBeastxX_\n-Youtube=XxSilentBeastGamerxX\n-Co-Owner=JassperBeastHD\n-Youtube=JassperBeastHD\n====[SBP Server]====\n';
    return 
    $output;
    break;
    case 
    "player.respawn":
    $output .='====[Death Message]====\n-You died\n-To bad you lose your stuff\n-Make sure to get your stuff back\n====[Death Message]====\n';
    return 
    $output;
    break;
    }
    }
    }
  11. SuperChipsLP
    Offline

    SuperChipsLP Active Member Plugin Developer

    Joined:
    Sep 15, 2013
    Posts:
    204
    Plugins:
    5
    Minecraft User:
    Redmol
    Try to put the $player = $data;
    in every case. not above them.
    Also, use $player->sendChat("Message");
  12. wies
    Offline

    wies Notable Member

    Joined:
    Aug 23, 2013
    Posts:
    390
    That only works with commands, not events.
    This is what the code should look like:
    PHP:
    public function handler($data$event){
        switch(
    $event){
            case 
    "player.join":
                
    $data->sendChat('====[SBP Server]====');
                
    $data->sendChat('Welcome @player to SBP Server');
                
    $data->sendChat('-Owner=XxSilentBeastxX_');
                
    $data->sendChat('-Youtube=XxSilentBeastGamerxX');
                
    $data->sendChat('-Co-Owner=JassperBeastHD');
                
    $data->sendChat('-Youtube=JassperBeastHD');
                
    $data->sendChat('====[SBP Server]====');
                break;
            case 
    "player.respawn":
                
    $data->sendChat('====[Death Message]====');
                
    $data->sendChat('-You died');
                
    $data->sendChat('-To bad you lose your stuff');
                
    $data->sendChat('-Make sure to get your stuff back');
                
    $data->sendChat('====[Death Message]====');
                break;
        }
    }
    JassperBeastHD and ZacHack like this.
  13. JassperBeastHD
    Offline

    JassperBeastHD Banned

    Joined:
    Aug 27, 2013
    Posts:
    436
    Minecraft User:
    JassperBeastHD
    Doesnt work wies -.-
  14. Glitchmaster_PE
    Offline

    Glitchmaster_PE Notable Member Plugin Developer

    Joined:
    Aug 31, 2013
    Posts:
    834
    Plugins:
    8
    Minecraft User:
    Glitchmaster_PE
    I think he meant:
    PHP:
    public function handler($data$event){
    switch(
    $event){
    case 
    "player.join":
    $data["player"]->sendChat('====[SBP Server]====');
    $data["player"]->sendChat('Welcome @player to SBP Server');
    $data["player"]->sendChat('-Owner=XxSilentBeastxX_');
    $data["player"]->sendChat('-Youtube=XxSilentBeastGamerxX');
    $data["player"]->sendChat('-Co-Owner=JassperBeastHD');
    $data["player"]->sendChat('-Youtube=JassperBeastHD');
    $data["player"]->sendChat('====[SBP Server]====');
    break;
    case 
    "player.respawn":
    $data["player"]->sendChat('====[Death Message]====');
    $data["player"]->sendChat('-You died');
    $data["player"]->sendChat('-To bad you lose your stuff');
    $data["player"]->sendChat('-Make sure to get your stuff back');
    $data["player"]->sendChat('====[Death Message]====');
    break;
    }
    }
  15. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,706
    Plugins:
    22
    Minecraft User:
    Falkirknh
    No he said earlier the events only hold player data so ["player"] isn't required.
  16. JassperBeastHD
    Offline

    JassperBeastHD Banned

    Joined:
    Aug 27, 2013
    Posts:
    436
    Minecraft User:
    JassperBeastHD
    Does it need $data = $player;???
  17. JassperBeastHD
    Offline

    JassperBeastHD Banned

    Joined:
    Aug 27, 2013
    Posts:
    436
    Minecraft User:
    JassperBeastHD
    Crash when joining server
    Code:
    # PocketMine-MP Error Dump Wed Nov 13 20:40:37 GMT 2013
    Error: array (
      'type' => 1,
      'message' => 'Cannot use object of type Player as array',
      'file' => '/mnt/sdcard/DroidPocketMine/src/API/PluginAPI.php(87) : eval()\'d code',
      'line' => 27,
    I tried pc dong work still -.-
  18. wies
    Offline

    wies Notable Member

    Joined:
    Aug 23, 2013
    Posts:
    390
    It does work, but I would recommend using "player.spawn" instead of "player.join"
  19. TrilogiForce
    Offline

    TrilogiForce Ban Evader Banned

    Joined:
    Sep 7, 2013
    Posts:
    228
    Minecraft User:
    TrilogiForce
    but every time a guy do /spawn it would tell that message every time!
  20. wies
    Offline

    wies Notable Member

    Joined:
    Aug 23, 2013
    Posts:
    390
    Not true. "player.respawn" will only be triggered when the player died and respawns

Share This Page

Advertisement