Allowing Players to control an Armor stand with WASD?

Discussion in 'Plugin Development' started by 360_, Jul 17, 2018.

Thread Status:
Not open for further replies.
  1. Offline

    360_

    I'm trying to create to make a Car plugin that allows players to control an armorstand by using WASD keys. The Problem I'm having is how I can go around to make the armorstand move when a player hits "W" or "A". How could I go about making the armorstand controllable with the WASD keys? Thanks in advanced.
     
  2. Offline

    Zombie_Striker

    @360_
    You should use ProtocolLib. Using that, listen for PacketType.Play.Client.STEER_VEHICLE. From there:

    1. Use event.getPacket().getFloat().readSafely(0); to check if the player is going right (+1) or left (-1). If it is 0, they did not move left or right.
    2. Use event.getPacket().getFloat().readSafely(1); to check if the player is going forward (=1) or backwards(-1)
    3. Use event.getPacket().getBooleans().readSafely(0) to check if they are jumping.
    4. Use event.getPacket().getBooleans().readSafely(1) to check if they are shifing (i.e attempted to eject from the car.)
     
  3. Offline

    360_

    @Zombie_Striker , So this is what i managed to get so far
    Code:
    @EventHandler
        public void onPlayerDrive(PacketEvent e) {
            if(e.getPacketType().equals(PacketType.Play.Client.STEER_VEHICLE)){
            }
        }
     
    Last edited: Jul 19, 2018
  4. Offline

    360_

    bump?
     
  5. Offline

    Unknown123

    @Zombie_Striker How to move the player left or right or forward or backwards? (Left for the players point of view, not just add or remove the x or z axis)
     
  6. Offline

    360_

    Bump
     
  7. Offline

    johnny boy

    use pitch and yaw
     
Thread Status:
Not open for further replies.

Share This Page