Packets Listening - Anarchick/skript-packet GitHub Wiki

In this example, we will try to detect any moves made by player when he his inside a vehicle (left/right/forward/backward/jump)

The first step is to know the %packettype% used for this packet, this is an useful code to help you :

function packetSearch(s: string):
    loop all packettypes:
        set {_packettype} to lowercase "%loop-value%"
        {_packettype} contain {_s}
        send formatted "<suggest command:%{_packettype}%>%{_packettype}%" to all players

Try this function with the string argument vehicle.

screenshot of packetSearch("vechicle")

In mc 1.16.5 we have 3 match. play_server_vehicle_move is send by the server to the client so it's not our packet. By experience I can tell you the answer : play_client_steer_vehicle

We have our %packettype%, let's look whats is inside (you have to enter in a minecart to trigger the event):

on packet event play_client_steer_vehicle:
    broadcast "<lime>%fields%"
    broadcast "<pink>%fields classes%"

fields and classes

We have 2 Floats and 2 booleans, go on wiki.vg#Steer_Vehicle to know what does this mean.

Now we know the utility of each fields , we have everything needed to detect when a player steer a vehicle !

on packet event play_client_steer_vehicle:
    set {_sideways} to field 0
    set {_forward} to field 1
    set {_jump} to field 2
    set {_unmount} to field 3
⚠️ **GitHub.com Fallback** ⚠️