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

Player move

Comments in 'Plugin Development' started by Creeperface, Sep 25, 2015.

  1. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    I want to make basic anticheat but i need to know few things:
    How can i find out if player motion is from server or from Client?
    How can i calculate e.g. how many blocks can player jump by effect level if has jump effect
  2. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    Learn how to use equations in PHP. And please try to be more specific.
  3. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Equations in PHP? Please be more specific.
    Player motion is always from the client. The server may use setMotion to request the player use a certain speed, but ultimately it is defined by the player - the player can always brake or sprint if he wants (although the server would cancel the exceptionally fast movement by using a method that can be considered as teleportation).
    For player jump amplitudes, you have to decompile MCPE to find that out. Though, you can find out some information from Google.
    thebigsmileXD and Creeperface like this.
  4. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    Thx and how can i find out if player motion is natural or changed by server?
  5. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    I don't think it is possible. Not sure, but why would you need that?
  6. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    I want to make some fly protection
  7. jojoe77777
    Offline

    jojoe77777 Notable Member Plugin Developer

    Joined:
    May 28, 2015
    Posts:
    653
    Plugins:
    1
    Minecraft User:
    jojoe77777
    I think the only way to do that is to listen to incoming packets.
  8. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    It appears that the player only sends where the player wants to go to (MovePlayerPacket) without telling you what speed it is using. PocketMine calculates the speed. If you want to do it in the packet stage, that means PocketMine had not handled it yet, then you have to calculate it yourself. Moreover, you still don't know whether the movement change comes from the server or player, as the player only tells you the result of the movement.

    The only possible way I can see is to listen to DataPacketSendEvent for SetEntityMotionPacket.
    Last edited: Sep 27, 2015
    jojoe77777 likes this.
  9. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    Arithmetic equations, obviously. :rolleyes:
    Don't you mean EntityMotionEvent, not SetEntityMotionEvent? :p
    Last edited: Sep 26, 2015
  10. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    I meant SetEntityMotionPacket.

    Arithmetic equation is not a term in PHP. What do you mean exactly? Did you mean arithmetic operators? I seriously don't see how arithmetics have an important role here.
    iJoshuaHD and Legoboy0215 like this.
  11. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
  12. Hotshot_9930
    Offline

    Hotshot_9930 Notable Member Plugin Developer

    Joined:
    May 26, 2014
    Posts:
    665
    Plugins:
    2
    Minecraft User:
    HotshotHD
    A simple way of making an anti - fly plugin would be to check if the block under a player has the ID of 0 (which is air), after a certain amount of time and the block ID is still 0, you punish the player.
  13. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    What happens if the player is jumping? o_O
  14. Hotshot_9930
    Offline

    Hotshot_9930 Notable Member Plugin Developer

    Joined:
    May 26, 2014
    Posts:
    665
    Plugins:
    2
    Minecraft User:
    HotshotHD
    Thats why i said "After a certain amount of time".
    This way, if you set the time limit to about 7 seconds a jumping player will surely land before 7 seconds, so the punishment wont take effect on them.
    I've used this method and it works perfectly.
  15. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    What if he is on a ladder, and only half of the player is on the ladder? And what about being stuck on a cobweb/lava/water block? And what about fences/fence gates/stone walls?
  16. Hotshot_9930
    Offline

    Hotshot_9930 Notable Member Plugin Developer

    Joined:
    May 26, 2014
    Posts:
    665
    Plugins:
    2
    Minecraft User:
    HotshotHD
    I dont think those would count as air blocks. They all have their own ID's.
    Legoboy0215 likes this.
  17. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    I mean, if the player's head is in cobweb and feet are in air.
    Or a very small part of the player is on ladder and other parts in air.
  18. Hotshot_9930
    Offline

    Hotshot_9930 Notable Member Plugin Developer

    Joined:
    May 26, 2014
    Posts:
    665
    Plugins:
    2
    Minecraft User:
    HotshotHD
    The cobweb seems like an easy fix. Im not too sure about the ladder though.
  19. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    Anyways an anti-fly is possible, you have to check a lot of things though.
  20. FlamingGenius
    Offline

    FlamingGenius Active Member

    Joined:
    Sep 23, 2015
    Posts:
    173
    Minecraft User:
    FlamingGenius
    Preppare thu self for newb comment :p
    So why not add an if statement perhaps like saying if the player is on ladder(im sure theres a function for this) then cancel the timer or if player is in cobweb check for a function saying player is in cobweb

Share This Page

Advertisement