Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- document.addEventListener('keydown', function(e){
- if(e.code == "ShiftLeft"){
- window.aimbot = true;
- }
- });
- document.addEventListener('keyup', function(e){
- if(e.code == "ShiftLeft"){
- window.aimbot = false;
- }
- });
- window.aimbot = false;
- window.calcAngle =function(us, them){
- if(!us.x){
- return [0,0]
- }
- var dx = us.x-them.x;
- var dy = us.y-them.y;
- var dz = us.z-them.z;
- var pitch_radi = (Math.atan2(dy, Math.sqrt(dx*dx+dz*dz)));
- var yaw_radi = -1*(Math.atan2(dz,dx)-1.57)
- if(dy >= 0){
- yaw_radi += Math.PI;
- }else{
- yaw_radi -= Math.PI;
- }
- return [pitch_radi, yaw_radi]
- }
- window.getDist = function(us,them){
- return Math.sqrt( (us.x-them.x)**2 + (us.y-them.y)**2 + (us.z-them.z)**2 )
- }
- function simpleStringify (object){
- var simpleObject = {};
- for (var prop in object ){
- if (!object.hasOwnProperty(prop)){
- continue;
- }
- if (typeof(object[prop]) == 'object'){
- continue;
- }
- if (typeof(object[prop]) == 'function'){
- continue;
- }
- simpleObject[prop] = object[prop];
- }
- return JSON.stringify(simpleObject);
- };
- window.getNearest = function(us, them){
- let near = {player:null,dist:null};
- for(var c in them){
- let player = them[c];
- if(player){
- console.log(simpleStringify(player))
- if(player.id != us.id && player.hp > 0){
- let dist_ = getDist(us,player);
- if(!near.player || dist_ < near.dist){
- near.player = player;
- near.dist = dist_;
- }
- }
- }
- }
- return near.player;
- }
- window.aimBot = function(us,them){
- let playerNear = getNearest(us,them)
- let angle = calcAngle(us,playerNear)
- return angle;
- }
- /* heres the hook
- //184935 e.runRenderLoop((function()
- if(aimbot){
- let a_ = aimBot(dr, xr);
- if(a_[0] && a_[1]){
- dr.pitch = a_[0];
- dr.yaw = a_[1];
- }
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement