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

Custom Plugin Error

Comments in 'Plugin Development' started by Mclover152, May 17, 2014.

  1. Mclover152
    Offline

    Mclover152 Active Member

    Joined:
    Apr 26, 2014
    Posts:
    64
    Minecraft User:
    mclover152
    I was making a simple custom plugin where you type /vote and it is SUPPOSED to say [ServerVoter] (@player) Voted for this server! But instead when i do /vote it tells me [ServerVoter] mclover152 voted for the server. Which is correct, but it tells other people [ServerVoter] (there username) voted for the server! I used @player in my coding, but it tells other people that they voted. Whats going on?!?!
  2. RekkuzaRage
    Offline

    RekkuzaRage Active Member

    Joined:
    Apr 15, 2014
    Posts:
    251
    Minecraft User:
    RekkuzaRage
    Try using $user instead of @player
  3. Mclover152
    Offline

    Mclover152 Active Member

    Joined:
    Apr 26, 2014
    Posts:
    64
    Minecraft User:
    mclover152
    How do i fix this?
  4. Mclover152
    Offline

    Mclover152 Active Member

    Joined:
    Apr 26, 2014
    Posts:
    64
    Minecraft User:
    mclover152
    Ok
  5. RekkuzaRage
    Offline

    RekkuzaRage Active Member

    Joined:
    Apr 15, 2014
    Posts:
    251
    Minecraft User:
    RekkuzaRage
    See if it works
  6. Mclover152
    Offline

    Mclover152 Active Member

    Joined:
    Apr 26, 2014
    Posts:
    64
    Minecraft User:
    mclover152
    Now it says "[ServerVoter] voted for this server!"
  7. RekkuzaRage
    Offline

    RekkuzaRage Active Member

    Joined:
    Apr 15, 2014
    Posts:
    251
    Minecraft User:
    RekkuzaRage
    hmm.....weird.
  8. Mclover152
    Offline

    Mclover152 Active Member

    Joined:
    Apr 26, 2014
    Posts:
    64
    Minecraft User:
    mclover152
    Plz help me.
  9. Dinokiller
    Offline

    Dinokiller Notable Member

    Joined:
    Sep 22, 2013
    Posts:
    376
    Minecraft User:
    Dinokiller_
    Show us the code where the the vote command is.
  10. mr.ahmad
    Offline

    mr.ahmad Banned

    Joined:
    Mar 23, 2014
    Posts:
    25
    Minecraft User:
    mr.ahmad
    what is the code ill see if i can fix it
  11. Mclover152
    Offline

    Mclover152 Active Member

    Joined:
    Apr 26, 2014
    Posts:
    64
    Minecraft User:
    mclover152
    Ok its:
    $this->api->console->register("vote", "Votes for the server!", array($this, "commandHandler));
    $this->api->ban->cmdwhitelist("vote");
    }

    Public function commandHandler($cmd, $params, $issuer, $alias){
    $this->api->chat->broadcast("[ServerVoter] $user voted for this server!");
    }

    Public function __destruct(){
    }
    }
    ?>
    (Not all coding just part)
  12. mr.ahmad
    Offline

    mr.ahmad Banned

    Joined:
    Mar 23, 2014
    Posts:
    25
    Minecraft User:
    mr.ahmad
    try this before the line.$this->api->chat->broadcast
    PHP:
    $username=issuer->$username
  13. mr.ahmad
    Offline

    mr.ahmad Banned

    Joined:
    Mar 23, 2014
    Posts:
    25
    Minecraft User:
    mr.ahmad
    and then try $username instead of $user
  14. mr.ahmad
    Offline

    mr.ahmad Banned

    Joined:
    Mar 23, 2014
    Posts:
    25
    Minecraft User:
    mr.ahmad
    i mean sorry do $issuer instead of $user
  15. mr.ahmad
    Offline

    mr.ahmad Banned

    Joined:
    Mar 23, 2014
    Posts:
    25
    Minecraft User:
    mr.ahmad
    did it work??
  16. Mclover152
    Offline

    Mclover152 Active Member

    Joined:
    Apr 26, 2014
    Posts:
    64
    Minecraft User:
    mclover152
    No, i put $username=$issuer->$username before the broadcast line and changed $user to $issuer and it didnt work
  17. wies
    Offline

    wies Notable Member

    Joined:
    Aug 23, 2013
    Posts:
    390
    You need to use
    $username = $issuer->username;
    Instead of
    $username = $issuer->$username;
    And change $user to $username
  18. Mclover152
    Offline

    Mclover152 Active Member

    Joined:
    Apr 26, 2014
    Posts:
    64
    Minecraft User:
    mclover152
    The console doesnt reconize the line where i put broadcast
  19. Mclover152
    Offline

    Mclover152 Active Member

    Joined:
    Apr 26, 2014
    Posts:
    64
    Minecraft User:
    mclover152
    Do i put $issuer, $user, or $username for the broadcast line
  20. Mclover152
    Offline

    Mclover152 Active Member

    Joined:
    Apr 26, 2014
    Posts:
    64
    Minecraft User:
    mclover152
    Yes!!!!! It worked!!!!!!! Thank you so much!!!!

Share This Page

Advertisement