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

How to get player speed

Comments in 'Plugin Development' started by MikkiMCPE, Sep 18, 2016.

  1. MikkiMCPE
    Offline

    MikkiMCPE Active Member

    Joined:
    May 16, 2015
    Posts:
    125
    Minecraft User:
    MikkiMC
    How to get player speed when player moves?
    Last edited: Sep 18, 2016
  2. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    The code you have is completely wrong.
    Foreach the Contents of the inventory and check if at least is a tool.
    applqpak likes this.
  3. MikkiMCPE
    Offline

    MikkiMCPE Active Member

    Joined:
    May 16, 2015
    Posts:
    125
    Minecraft User:
    MikkiMC
    yea, i need test for many times, and i found my way, thx btw.

    And, i was edited the thread, new topic.
    Last edited: Sep 18, 2016
  4. JackboyPlay
    Offline

    JackboyPlay Active Member

    Joined:
    Apr 25, 2015
    Posts:
    507
    Minecraft User:
    JackboyPlay
    In Nukkit existst something like player.getMovementSpeed () maybe exists something like that in PocketMine too
  5. MikkiMCPE
    Offline

    MikkiMCPE Active Member

    Joined:
    May 16, 2015
    Posts:
    125
    Minecraft User:
    MikkiMC
    i hope pocketmine will really soon to implements new things :(.
  6. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    You should have rather posted your working code and marked it as solved. Beginners might want the exact same and could just look at this thread instead of creating a new one.

    Anyways, I think third-party PocketMine softwares (not all of them) have Player::getSpeed(). Though, I don't think that changes with a speed hack. You should create an own plugin for this, not just use that function. (if it even works)
    ImagicalGamer, MikkiMCPE and applqpak like this.
  7. jasonwynn10
    Offline

    jasonwynn10 Active Member

    Joined:
    Dec 20, 2015
    Posts:
    87
    Minecraft User:
    jasonwynn10
    you have to use the PlayerMoveEvent to get the distance / time
  8. MyNameIsTriXz
    Offline

    MyNameIsTriXz Notable Member

    Joined:
    Aug 17, 2015
    Posts:
    538
    Minecraft User:
    MyNameIsTriXz
    It's simple:
    PHP:
    $speed abs($player->getMotion()->x) + abs($player->getMotion->z);
    abs(); turns a negative value into a positive one, so it always returns a positive value, that's how you still get the real speed although the player's X motion is -1 and his Z motion is 1.
    jasonwynn10 likes this.
  9. ImagicalGamer
    Offline

    ImagicalGamer Active Member

    Joined:
    Feb 25, 2016
    Posts:
    141
    Minecraft User:
    ImagicalGamer
    The Player::getMovementSpeed() doesn't change when you use speed hacks.
  10. MikkiMCPE
    Offline

    MikkiMCPE Active Member

    Joined:
    May 16, 2015
    Posts:
    125
    Minecraft User:
    MikkiMC
    i'll try this one.
    jasonwynn10 and ImagicalGamer like this.
  11. JUZEXMOD
    Offline

    JUZEXMOD New Member

    Joined:
    May 28, 2016
    Posts:
    19
    Minecraft User:
    JUZEXMOD
    PHP:
            $Effect Effect::getEffect(1);  /* speed id */
            
    $effect->setAmplifier(2);    /* speed Power */
            
    $effect->setVisible(true);
            
    $effect->setDuration(10000000000);  /* speed Time */
            
    $sender->addEffect($effect);
  12. Nawaf_Craft1b
    Offline

    Nawaf_Craft1b Active Member Plugin Developer

    Joined:
    May 8, 2015
    Posts:
    232
    Plugins:
    1
    Minecraft User:
    Nawaf_Craft1b
    No effect speed , It is getSpeed
  13. JackboyPlay
    Offline

    JackboyPlay Active Member

    Joined:
    Apr 25, 2015
    Posts:
    507
    Minecraft User:
    JackboyPlay
    Go away before I start to cry
  14. JUZEXMOD
    Offline

    JUZEXMOD New Member

    Joined:
    May 28, 2016
    Posts:
    19
    Minecraft User:
    JUZEXMOD
    oh -__-
  15. XShockinFireX
    Offline

    XShockinFireX New Member

    Joined:
    Jan 28, 2016
    Posts:
    14
    Minecraft User:
    XShockinFireX
    Oh, how about you understand what this thread is about before commenting?
  16. ImagicalGamer
    Offline

    ImagicalGamer Active Member

    Joined:
    Feb 25, 2016
    Posts:
    141
    Minecraft User:
    ImagicalGamer
    If your still looking for an answer to this, one way that I have used is despawn the player and spawn a Human entity with the players ID then sync the movement so you can manage the Human entity's movement.
    XShockinFireX likes this.
  17. jasonwynn10
    Offline

    jasonwynn10 Active Member

    Joined:
    Dec 20, 2015
    Posts:
    87
    Minecraft User:
    jasonwynn10
    And if they aren't, then they need to mark the post as resolved...
    ImagicalGamer likes this.

Share This Page

Advertisement