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

[SOLVED] player.gamemode.change

Comments in 'Plugin Development' started by jython234, May 11, 2014.

  1. jython234
    Offline

    jython234 Notable Member Plugin Developer

    Joined:
    Nov 4, 2013
    Posts:
    324
    Plugins:
    1
    Minecraft User:
    jython234
    Hello everyone!
    Its me, jython234, with a problem...
    So I handler shown below:
    PHP:
     public function onGamemodeChange($player){
           
    //Player gamemode change event
           
    $playerName $player['username'];
           
    $this->api->chat->broadcast("[JyChat]:  $playerName had their gamemode changed to: "$player->gamemode);
         }
    The problem is, when a player changes their gamemode the name shows up blank...
    I've also tried:
    PHP:
    $player->username
    $player
    ->iusername
    How can I get the player's name? Without it, this message isn't going to be helpful...
  2. InusualZ
    Offline

    InusualZ Active Member Plugin Developer

    Joined:
    Aug 23, 2013
    Posts:
    218
    Plugins:
    1
    Minecraft User:
    Inusu4lZ
    Because is:
    PHP:
    public function onGamemodeChange($player){
           
    //Player gamemode change event
           
    $playerName $player['player']->username;
           
    $this->api->chat->broadcast("[JyChat]:  $playerName had their gamemode changed to: "$player['gamemode']);
         }
    The event send a array. Player(Object) and Gamemode(Int)
    jython234 and iJoshuaHD like this.
  3. jython234
    Offline

    jython234 Notable Member Plugin Developer

    Joined:
    Nov 4, 2013
    Posts:
    324
    Plugins:
    1
    Minecraft User:
    jython234
    Ohhh... Thanks!

Share This Page

Advertisement