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

need help

Comments in 'Plugin Development' started by Legomite, Oct 19, 2013.

  1. Legomite
    Offline

    Legomite Active Member Plugin Developer

    Joined:
    Sep 8, 2013
    Posts:
    470
    Plugins:
    2
    Minecraft User:
    Legomite
    Okay so im making this siri plugin but I need help for .sentence or something.

    example not working

    you /siri hi gukgkugkuguk

    response
    hi
    <Siri>Siri says hi back

    what is suppose to happen is

    you /siri hi gukgkugkuguk

    response

    hi gukgkugkuguk
    <siri> Siri says hi back
  2. SuperChipsLP
    Offline

    SuperChipsLP Active Member Plugin Developer

    Joined:
    Sep 15, 2013
    Posts:
    204
    Plugins:
    5
    Minecraft User:
    Redmol
    What do you exactly need help with?
    Give us a code or something you have made.
    Otherwise we can't help you.
  3. Legomite
    Offline

    Legomite Active Member Plugin Developer

    Joined:
    Sep 8, 2013
    Posts:
    470
    Plugins:
    2
    Minecraft User:
    Legomite
    this wont work. the .sentence it is suppose to say what you said.

    /siri hi DUDE

    response
    hi DUDE
    <siri> Hi

    but all it says is hi because the word after that can be made up to different words.like hi dawdw hi dude hi fart and it will still run the command
  4. SuperChipsLP
    Offline

    SuperChipsLP Active Member Plugin Developer

    Joined:
    Sep 15, 2013
    Posts:
    204
    Plugins:
    5
    Minecraft User:
    Redmol
    Sorry, i don't understand you. Can you give us the code, please?
  5. Legomite
    Offline

    Legomite Active Member Plugin Developer

    Joined:
    Sep 8, 2013
    Posts:
    470
    Plugins:
    2
    Minecraft User:
    Legomite
    case "hello":
    $sentence = implode(" ", $arg);
    $this->api->chat->broadcast("Hello ".$sentence);
    $this->api->chat->broadcast("<Siri> Hello master!");
    break;
  6. Legomite
    Offline

    Legomite Active Member Plugin Developer

    Joined:
    Sep 8, 2013
    Posts:
    470
    Plugins:
    2
    Minecraft User:
    Legomite
    sentence wont work.just says stupid hello
  7. SuperChipsLP
    Offline

    SuperChipsLP Active Member Plugin Developer

    Joined:
    Sep 15, 2013
    Posts:
    204
    Plugins:
    5
    Minecraft User:
    Redmol
    Maybe because $sentence isn't set?
  8. Legomite
    Offline

    Legomite Active Member Plugin Developer

    Joined:
    Sep 8, 2013
    Posts:
    470
    Plugins:
    2
    Minecraft User:
    Legomite
    err how do you set it
  9. SuperChipsLP
    Offline

    SuperChipsLP Active Member Plugin Developer

    Joined:
    Sep 15, 2013
    Posts:
    204
    Plugins:
    5
    Minecraft User:
    Redmol
    Take a look at a few other plugins. You will find that out there :)
  10. Legomite
    Offline

    Legomite Active Member Plugin Developer

    Joined:
    Sep 8, 2013
    Posts:
    470
    Plugins:
    2
    Minecraft User:
    Legomite
    but pocket essientals is all I fouynd. And it dosent need it to be set
  11. SuperChipsLP
    Offline

    SuperChipsLP Active Member Plugin Developer

    Joined:
    Sep 15, 2013
    Posts:
    204
    Plugins:
    5
    Minecraft User:
    Redmol
    PocketMine/PHP doesn't know what $sentence is. You need to define it somewhre. You can't go and just load it, when the string doesn't contain anything...
  12. SuperChipsLP
    Offline

    SuperChipsLP Active Member Plugin Developer

    Joined:
    Sep 15, 2013
    Posts:
    204
    Plugins:
    5
    Minecraft User:
    Redmol
    Or to say it better, it doesn't know what $arg is.
  13. Legomite
    Offline

    Legomite Active Member Plugin Developer

    Joined:
    Sep 8, 2013
    Posts:
    470
    Plugins:
    2
    Minecraft User:
    Legomite
    okay Umm I forgot how to DEFINE
  14. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Is this your code, I suppose?
    PHP:
    public class abc{
    public function 
    init(){
      
    $this->api->console->register("siri","",array($this,"abc");
    }
    public function 
    abc($cmd,$arg,$isser){
      switch(
    $arg[0]){
    case 
    "hello":
    $sentence implode(" "$arg);
    $this->api->chat->broadcast("Hello ".$sentence);
    $this->api->chat->broadcast("<Siri> Hello master!");
    break;
      }
    }
    }
  15. Legomite
    Offline

    Legomite Active Member Plugin Developer

    Joined:
    Sep 8, 2013
    Posts:
    470
    Plugins:
    2
    Minecraft User:
    Legomite
    M
    my older code. I removed the hello .sentence check out version 2.2.1
  16. Legomite
    Offline

    Legomite Active Member Plugin Developer

    Joined:
    Sep 8, 2013
    Posts:
    470
    Plugins:
    2
    Minecraft User:
    Legomite
    Wait, it works like that?

Share This Page

Advertisement