forked from SelfMadeSystem/Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AACVelocity.js
114 lines (97 loc) · 7.32 KB
/
AACVelocity.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
var scriptName = "AACVelocity";
var scriptVersion = 1.0;
var scriptAuthor = "Sms_Gamer";
var AACVelocity = new AACVelocity();
var client;
var strafeModule = moduleManager.getModule("Strafe");
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Converts from degrees to radians.
Math.radians = function(degrees) {
return degrees * Math.PI / 180;
};
// Converts from radians to degrees.
Math.degrees = function(radians) {
return radians * 180 / Math.PI;
};
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function vClip(offset) {
mc.thePlayer.setPosition(mc.thePlayer.posX, mc.thePlayer.posY + offset, mc.thePlayer.posZ);
}
function hClip(offset) {
var playerYaw = Math.radians(mc.thePlayer.rotationYaw);
mc.thePlayer.setPosition(mc.thePlayer.posX - (Math.sin(playerYaw) * offset), mc.thePlayer.posY, mc.thePlayer.posZ + (Math.cos(playerYaw) * offset));
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function hMotion(offset) {
mc.thePlayer.motionX = parseFloat(Math.cos(Math.radians(mc.thePlayer.rotationYaw + 90.0)) * offset * Math.sin(Math.radians(mc.thePlayer.rotationYaw + 90.0)))
mc.thePlayer.motionZ = parseFloat(Math.sin(Math.radians(mc.thePlayer.rotationYaw + 90.0)) * offset * Math.cos(Math.radians(mc.thePlayer.rotationYaw + 90.0)))
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function setMoveSpeed(movespeed) {
if (mc.thePlayer.movementInput.moveStrafe == 0 && mc.thePlayer.movementInput.moveForward != 0) {
mc.thePlayer.motionX = parseFloat(mc.thePlayer.movementInput.moveForward * movespeed * Math.cos(Math.radians(mc.thePlayer.rotationYaw + 90.0)) )
mc.thePlayer.motionZ = parseFloat(mc.thePlayer.movementInput.moveForward * movespeed * Math.sin(Math.radians(mc.thePlayer.rotationYaw + 90.0)) )
} else if (mc.thePlayer.movementInput.moveStrafe != 0 && mc.thePlayer.movementInput.moveForward != 0){
mc.thePlayer.motionX = parseFloat((mc.thePlayer.movementInput.moveForward / 1.4142135623730950488016887242097) * movespeed * Math.cos(Math.radians(mc.thePlayer.rotationYaw + 90.0)) + (mc.thePlayer.movementInput.moveStrafe / 1.4142135623730950488016887242097) * movespeed * Math.sin(Math.radians(mc.thePlayer.rotationYaw + 90.0)))
mc.thePlayer.motionZ = parseFloat((mc.thePlayer.movementInput.moveForward / 1.4142135623730950488016887242097) * movespeed * Math.sin(Math.radians(mc.thePlayer.rotationYaw + 90.0)) - (mc.thePlayer.movementInput.moveStrafe / 1.4142135623730950488016887242097) * movespeed * Math.cos(Math.radians(mc.thePlayer.rotationYaw + 90.0)))
} else if (mc.thePlayer.movementInput.moveStrafe != 0 && mc.thePlayer.movementInput.moveForward == 0){
mc.thePlayer.motionX = parseFloat((mc.thePlayer.movementInput.moveForward / 1) * movespeed * Math.cos(Math.radians(mc.thePlayer.rotationYaw + 90.0)) + (mc.thePlayer.movementInput.moveStrafe / 1) * movespeed * Math.sin(Math.radians(mc.thePlayer.rotationYaw + 90.0)))
mc.thePlayer.motionZ = parseFloat((mc.thePlayer.movementInput.moveForward / 1) * movespeed * Math.sin(Math.radians(mc.thePlayer.rotationYaw + 90.0)) - (mc.thePlayer.movementInput.moveStrafe / 1) * movespeed * Math.cos(Math.radians(mc.thePlayer.rotationYaw + 90.0)))
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function playerMoveSpeed(movespeed) {
if (mc.thePlayer.movementInput.moveStrafe == 0 && mc.thePlayer.movementInput.moveForward != 0) {
mc.thePlayer.motionX = parseFloat(mc.thePlayer.movementInput.moveForward * movespeed * Math.cos(Math.radians(mc.thePlayer.rotationYaw + 90.0)) )
mc.thePlayer.motionZ = parseFloat(mc.thePlayer.movementInput.moveForward * movespeed * Math.sin(Math.radians(mc.thePlayer.rotationYaw + 90.0)) )
} else if (mc.thePlayer.movementInput.moveStrafe != 0 && mc.thePlayer.movementInput.moveForward != 0){
mc.thePlayer.motionX = parseFloat((mc.thePlayer.movementInput.moveForward / 1.4142135623730950488016887242097) * movespeed * Math.cos(Math.radians(mc.thePlayer.rotationYaw + 90.0)) + (mc.thePlayer.movementInput.moveStrafe / 1.4142135623730950488016887242097) * movespeed * Math.sin(Math.radians(mc.thePlayer.rotationYaw + 90.0)))
mc.thePlayer.motionZ = parseFloat((mc.thePlayer.movementInput.moveForward / 1.4142135623730950488016887242097) * movespeed * Math.sin(Math.radians(mc.thePlayer.rotationYaw + 90.0)) - (mc.thePlayer.movementInput.moveStrafe / 1.4142135623730950488016887242097) * movespeed * Math.cos(Math.radians(mc.thePlayer.rotationYaw + 90.0)))
} else if (mc.thePlayer.movementInput.moveStrafe != 0 && mc.thePlayer.movementInput.moveForward == 0){
mc.thePlayer.motionX = parseFloat((mc.thePlayer.movementInput.moveForward / 1) * movespeed * Math.cos(Math.radians(mc.thePlayer.rotationYaw + 90.0)))/* + (mc.thePlayer.movementInput.moveStrafe / 1) * movespeed * Math.sin(Math.radians(mc.thePlayer.rotationYaw + 90.0)))*/
mc.thePlayer.motionZ = parseFloat((mc.thePlayer.movementInput.moveForward / 1) * movespeed * Math.sin(Math.radians(mc.thePlayer.rotationYaw + 90.0)))/* - (mc.thePlayer.movementInput.moveStrafe / 1) * movespeed * Math.cos(Math.radians(mc.thePlayer.rotationYaw + 90.0))))*/
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function AACVelocity() {
var once = false;
this.getName = function() {
return "AACVelocity";
};
this.getDescription = function() {
return "AACVelocity";
};
this.getCategory = function() {
return "Combat";
};
this.onEnable = function() {
once = false;
}
this.onUpdate = function() {
if(mc.thePlayer.hurtTime == 9 & once == true & mc.thePlayer.onGround == true){
//mc.thePlayer.motionY *= 0.9999999
once = false;
}
if(mc.thePlayer.hurtTime > 0 & mc.thePlayer.hurtTime <= 7) {
mc.thePlayer.motionX *= 0.5
mc.thePlayer.motionZ *= 0.5
}
if(mc.thePlayer.hurtTime == 5) {
mc.thePlayer.motionX = 0.0
mc.thePlayer.motionZ = 0.0
once = true;
}
if(mc.thePlayer.hurtTime == 4){
hClip(0.05)
}
}
this.onDisable = function () {
}
}
function onLoad() {}
function onEnable() {
client = moduleManager.registerModule(AACVelocity);
}
function onDisable() {
moduleManager.unregisterModule(client);
}