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

sendTo();

Comments in 'Plugin Development' started by LDX, Jan 11, 2014.

  1. LDX
    Offline

    LDX Notable Member Plugin Developer

    Joined:
    Oct 2, 2013
    Posts:
    1,434
    Plugins:
    14
    I'm having problems with sendTo();. I type this into my plugin:
    PHP:
    $user $issuer->username;
    $this->api->chat->sendTo(false,"MESSAGE",$user);
    and nothing happens. :/

    (P.S. to @Falk and @Glitchmaster_PE: I fixed $args and $issuer. :D)
  2. Glitchmaster_PE
    Offline

    Glitchmaster_PE Notable Member Plugin Developer

    Joined:
    Aug 31, 2013
    Posts:
    834
    Plugins:
    8
    Minecraft User:
    Glitchmaster_PE
    Just do:

    PHP:
    $user $issuer;
    $user->sendChat("MESSAGE");
  3. Glitchmaster_PE
    Offline

    Glitchmaster_PE Notable Member Plugin Developer

    Joined:
    Aug 31, 2013
    Posts:
    834
    Plugins:
    8
    Minecraft User:
    Glitchmaster_PE
    You need to use the object of the user, not just his name
  4. LDX
    Offline

    LDX Notable Member Plugin Developer

    Joined:
    Oct 2, 2013
    Posts:
    1,434
    Plugins:
    14
    DANG, GLITCH, YOU'RE FAST. My page finished loading and I clicked your name because I thought I might have spelled it wrong, and it said you were seen a moment ago viewing this thread. o_O LESS THAN 5 SECONDS.
    Last edited: Jan 13, 2014
  5. LDX
    Offline

    LDX Notable Member Plugin Developer

    Joined:
    Oct 2, 2013
    Posts:
    1,434
    Plugins:
    14
    And is that the same as:
    PHP:
    $issuer->sendChat("MESSAGE");
    ?
  6. LDX
    Offline

    LDX Notable Member Plugin Developer

    Joined:
    Oct 2, 2013
    Posts:
    1,434
    Plugins:
    14
    The server is complaining that $user isn't an object.
  7. Glitchmaster_PE
    Offline

    Glitchmaster_PE Notable Member Plugin Developer

    Joined:
    Aug 31, 2013
    Posts:
    834
    Plugins:
    8
    Minecraft User:
    Glitchmaster_PE
    Yes, but you wanted to use $user so I let you ;)
  8. LDX
    Offline

    LDX Notable Member Plugin Developer

    Joined:
    Oct 2, 2013
    Posts:
    1,434
    Plugins:
    14
    I did that because I thought the problem was I was using $issuer right in the function, like:
    PHP:
    $this->api->chat->sendTo(false,"MESSAGE",$issuer);
  9. Glitchmaster_PE
    Offline

    Glitchmaster_PE Notable Member Plugin Developer

    Joined:
    Aug 31, 2013
    Posts:
    834
    Plugins:
    8
    Minecraft User:
    Glitchmaster_PE
    Well, just do $issuer->sendChat("Message");
  10. LDX
    Offline

    LDX Notable Member Plugin Developer

    Joined:
    Oct 2, 2013
    Posts:
    1,434
    Plugins:
    14
  11. Glitchmaster_PE
    Offline

    Glitchmaster_PE Notable Member Plugin Developer

    Joined:
    Aug 31, 2013
    Posts:
    834
    Plugins:
    8
    Minecraft User:
    Glitchmaster_PE
    $user isn't. It is simply the users name. Think about it as the different between who you are and the name you go by
    PEMapModder and LDX like this.
  12. LDX
    Offline

    LDX Notable Member Plugin Developer

    Joined:
    Oct 2, 2013
    Posts:
    1,434
    Plugins:
    14
    Starting to make sense...
    Who I am: Luke Darling;
    What I go by: LDX;
  13. Glitchmaster_PE
    Offline

    Glitchmaster_PE Notable Member Plugin Developer

    Joined:
    Aug 31, 2013
    Posts:
    834
    Plugins:
    8
    Minecraft User:
    Glitchmaster_PE
    Maybe a better way to think about it is: Your body vs. you name
  14. LDX
    Offline

    LDX Notable Member Plugin Developer

    Joined:
    Oct 2, 2013
    Posts:
    1,434
    Plugins:
    14
    How do I make $issuer an object? Sometimes, I feel like such an idiot... It's still complaining that $issuer isn't an object.
  15. Glitchmaster_PE
    Offline

    Glitchmaster_PE Notable Member Plugin Developer

    Joined:
    Aug 31, 2013
    Posts:
    834
    Plugins:
    8
    Minecraft User:
    Glitchmaster_PE
    It should be...
  16. LDX
    Offline

    LDX Notable Member Plugin Developer

    Joined:
    Oct 2, 2013
    Posts:
    1,434
    Plugins:
    14
    Ok, I'm going to post some of my code to show where $issuer works, and to show where I put it.
    PHP:
    // stuff
    public function [SECRETNO ONE CAN KNOW YET]($cmd,$args,$issuer) {
    $this->api->chat->broadcast("MY MESSAGE TO WHOLE SERVER " $issuer); // Outputs "MY MESSAGE TO WHOLE SERVER LukeDarling".
    $issuer->sendChat("MESSAGE"); // Outputs to LukeDarling "". (A.K.A. ABSOLUTELY NOTHING, NOT EVEN A NEW LINE.)
    }
    // more stuff
  17. Glitchmaster_PE
    Offline

    Glitchmaster_PE Notable Member Plugin Developer

    Joined:
    Aug 31, 2013
    Posts:
    834
    Plugins:
    8
    Minecraft User:
    Glitchmaster_PE
    PHP:
    // stuff
    public function [SECRETNO ONE CAN KNOW YET]($cmd,$args,$issuer) {
    $username $issuer->username;
    $this->api->chat->broadcast("MY MESSAGE TO WHOLE SERVER " $username); // Outputs "MY MESSAGE TO WHOLE SERVER LukeDarling".
    $issuer->sendChat("MESSAGE"); // Outputs to LukeDarling "". (A.K.A. ABSOLUTELY NOTHING, NOT EVEN A NEW LINE.)
    }
    // more stuff
  18. LDX
    Offline

    LDX Notable Member Plugin Developer

    Joined:
    Oct 2, 2013
    Posts:
    1,434
    Plugins:
    14
    Um, the broadcast part works... It's sendChat that doesn't. XD
  19. LDX
    Offline

    LDX Notable Member Plugin Developer

    Joined:
    Oct 2, 2013
    Posts:
    1,434
    Plugins:
    14
    Unless... Does printing $issuer as part of a string make it a non-object?
  20. Glitchmaster_PE
    Offline

    Glitchmaster_PE Notable Member Plugin Developer

    Joined:
    Aug 31, 2013
    Posts:
    834
    Plugins:
    8
    Minecraft User:
    Glitchmaster_PE
    Are you sure? What line is the error on. I think the error is that you tried to broadcast an object

Share This Page

Advertisement