Created
July 28, 2011 01:50
-
-
Save Pwootage/1110759 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var posx = -146; | |
var posy = 64; | |
var posz = 67; | |
var ppos = player.getPosition(); | |
if (ppos.x > posx && ppos.x < posx+1) | |
{ | |
if (ppos.z > posz && ppos.z < posz+1) | |
{ | |
if (ppos.y > posy) | |
{ | |
dist = Math.floor(Math.abs(ppos.y - posy)); | |
chat.print("Ppos: (" + ppos.x + ", " + ppos.y + ", " + ppos.z + ")"); | |
chat.print("pos: (" + posx + ", " + posy + ", " + posz + ")"); | |
chat.print("Dist: " + dist); | |
if (dist < 4) | |
{ | |
var pvel = player.getVelocity(); | |
var dist2 = Math.sqrt((posx + 0.5 - ppos.x)^2 + (posy + 0.5 - ppos.y)^2 + (posz + 0.5 - ppos.z)^2); | |
if (dist2 == 0) dist2 += 0.1; | |
player.setVelocity(pvel.x, pvel.y + 0.07000000000000001 * dist / dist2, pvel.z); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment