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

help with making a plugin i get an error with the code

Comments in 'Plugin Development' started by jerlegoman, Jan 7, 2014.

  1. jerlegoman
    Offline

    jerlegoman Active Member

    Joined:
    Dec 10, 2013
    Posts:
    120
    Minecraft User:
    jeremy647
    Hi, my name is Jemry647 or Jerlegoman,
    I am developing my own plugin but when I tried the PHP code it crashed the server can someone who is good at developing plugins please help me. thanks.
    I attached the files.
    if you need to change the error file back to a .log you can do so.
    THANKS:)

    Attached Files:

  2. Darunia18
    Offline

    Darunia18 Staff Member Sectional Moderator

    Joined:
    Aug 23, 2013
    Posts:
    754
    Plugins:
    2
    Minecraft User:
    Darunia18
    Well....there seems to be a few lines of codes that don't seem to make much sense. I would change some things with it, but I think I would change it too much and it wouldn't be your plugin anymore. Just a few tips: 1. If you're having some trouble with PHP, check out codecademy.com and if you're having trouble learning the PocketMine API, check out @Glitchmaster_PE 's tutorial. 2. I noticed that you are using space instead of tab, as you have to do with yml files. With php files, you are allowed to use tab and it saves a lot of time :)

    If you need additional help, let me know.
  3. jerlegoman
    Offline

    jerlegoman Active Member

    Joined:
    Dec 10, 2013
    Posts:
    120
    Minecraft User:
    jeremy647
    If you help I'll give you most credit
  4. jerlegoman
    Offline

    jerlegoman Active Member

    Joined:
    Dec 10, 2013
    Posts:
    120
    Minecraft User:
    jeremy647
    if you help I'll give you most credit
  5. tristan gybels
    Offline

    tristan gybels New Member

    Joined:
    Nov 26, 2013
    Posts:
    102
    Minecraft User:
    PaddoOne
    What are you making?
  6. Darunia18
    Offline

    Darunia18 Staff Member Sectional Moderator

    Joined:
    Aug 23, 2013
    Posts:
    754
    Plugins:
    2
    Minecraft User:
    Darunia18
    It is a plugin that, when a player does /jokes it will give you 1 random knock-knock joke :p
  7. tristan gybels
    Offline

    tristan gybels New Member

    Joined:
    Nov 26, 2013
    Posts:
    102
    Minecraft User:
    PaddoOne
    ok, lol xD
  8. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    First, what is $user for while it isn't used?
    I think it should be /jokes <player> to send a random joke to the specified player?
    Delete the break; statement. You aren't in a for loop or switch block.
    Very simple to fix then.
    Change $user=blah blah blah to this:
    PHP:
    $issuer=ServerAPI::request()->api->player->get(isset($args[0])?$args[0]:$issuer->username);
    Also, put the $args parameter after
    PHP:
    public function commandHandler(
    at the second place.
  9. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    It is curious you know array_rand() but don't know about the parameters things and the meaning of "break"?
  10. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Hope I helped. If I did, like me.

Share This Page

Advertisement