Packet nofall

var module = rise.registerModule("Packet No Fall", "A No Fall ported from Rise 5 to Rise 6's scripting api.")

var fallDistance = 0;

script.handle("onUnload", function () {
	module.unregister()
})

// Called 20 times per second
module.handle("onPreMotion", function(e) {
	var difference = player.getLastPosition().getY() - player.getPosition().getY();

	if (difference > 0) fallDistance += difference

	if (player.onGround) fallDistance = 0
	
	if (fallDistance > 2) {
		packet.sendPosition(true)
		rise.displayChat("Sent")
		fallDistance = 0
	}

	return e
})

Last updated