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

Having an error developing a plugins.

Comments in 'Plugin Development' started by linuxboytoo, Sep 17, 2013.

  1. linuxboytoo
    Offline

    linuxboytoo Plugin Developer

    Joined:
    Sep 11, 2013
    Posts:
    41
    Plugins:
    4
    Minecraft User:
    linuxboytoo
    Trying to use the teleport method of the player API. I am attempting to teleport myself to myself. Not sure if this is a bug or if this is a problem in my code. I am only trying to teleport myself to myself because I don't have anyone else to test with atm. Real world it would be from user to user.

    In the example issuer is

    PHP:
    public function testing($cmd,$params,$issuer,$alias) { $player $this->api->player->get("linuxboytoo"); $player->teleport($player->username,$issuer->username); }
    Error:
    Error: array (
    'type' => 4096,
    'message' => 'Argument 1 passed to Player::teleport() must be an instance of Vector3, string given, called in /pocketmine/dev/src/API/PluginAPI.php(87) : eval()\'d code on line 36 and defined',
    'file' => '/pocketmine/dev/src/Player.php',
    'line' => 748,
    )
  2. ZacHack
    Offline

    ZacHack Staff Member Sectional Moderator

    Joined:
    Aug 23, 2013
    Posts:
    326
    Plugins:
    6
    Minecraft User:
    _ZacHack_
    You need to get the x y and z of the target player and put them in a variable. It reads the teleport like this $player->teleport(x,y,z) so you can variable those also
  3. linuxboytoo
    Offline

    linuxboytoo Plugin Developer

    Joined:
    Sep 11, 2013
    Posts:
    41
    Plugins:
    4
    Minecraft User:
    linuxboytoo
    The teleport method in the player API doesn't allow for 3 arguments and my understanding looking at te code it's player names that it wants. Am I missing something?
  4. ZacHack
    Offline

    ZacHack Staff Member Sectional Moderator

    Joined:
    Aug 23, 2013
    Posts:
    326
    Plugins:
    6
    Minecraft User:
    _ZacHack_
    Did u try the 3 args?
  5. linuxboytoo
    Offline

    linuxboytoo Plugin Developer

    Joined:
    Sep 11, 2013
    Posts:
    41
    Plugins:
    4
    Minecraft User:
    linuxboytoo
    Not yet. The problem is that I want to understand what I'm doing I don't want to just do it for the sake of doing. Do you know why the method doesn't show three arguments and am I maybe using the objects incorrectly?
  6. linuxboytoo
    Offline

    linuxboytoo Plugin Developer

    Joined:
    Sep 11, 2013
    Posts:
    41
    Plugins:
    4
    Minecraft User:
    linuxboytoo
    I was using the player object instead of the player api object. Switched to player API object and it worked great. Next problem is registering commands that can be run by regular users. I get a "You don't have permissions to use this command." when a non-op runs the registered command.
  7. ZacHack
    Offline

    ZacHack Staff Member Sectional Moderator

    Joined:
    Aug 23, 2013
    Posts:
    326
    Plugins:
    6
    Minecraft User:
    _ZacHack_
    Enter this in the init function

    PHP:
    $this->api->ban->cmdwhitelist("command");
  8. linuxboytoo
    Offline

    linuxboytoo Plugin Developer

    Joined:
    Sep 11, 2013
    Posts:
    41
    Plugins:
    4
    Minecraft User:
    linuxboytoo
    Yup found that - Thanks ZacHack
  9. ZacHack
    Offline

    ZacHack Staff Member Sectional Moderator

    Joined:
    Aug 23, 2013
    Posts:
    326
    Plugins:
    6
    Minecraft User:
    _ZacHack_
    No problem

Share This Page

Advertisement