Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function toDirectionalVector(vector, yaw, pitch) { //some parts of this function are made by @zhuowei
- vector[0] = Math.cos(yaw) * Math.cos(0);
- vector[1] = Math.sin(pitch);
- vector[2] = Math.sin(yaw) * Math.cos(0);
- }
- var playerDir = [0, 0, 0];
- var DEG_TO_RAD = Math.PI / 180;
- var playerWalkSpeed = 0.2;
- var autoWalk = {
- name: "AutoWalk",
- desc: "Makes your player walk automatically.",
- category: VertexClientPE.category.MOVEMENT,
- type: "Mod",
- state: false,
- isStateMod: function() {
- return true;
- },
- onToggle: function() {
- this.state = !this.state;
- },
- onTick: function() {
- toDirectionalVector(playerDir, (getYaw() + 90) * DEG_TO_RAD, getPitch() * DEG_TO_RAD * -1);
- var player = getPlayerEnt();
- setVelX(player, playerWalkSpeed * playerDir[0]);
- if(Player.isFlying()) {
- setVelY(player, playerWalkSpeed * playerDir[1]);
- }
- setVelZ(player, playerWalkSpeed * playerDir[2]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement