Advertisement
Guest User

Untitled

a guest
Apr 4th, 2020
319
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.76 KB | None | 0 0
  1.  
  2. local quickpeek_key = gui.new_checkbox('Quickpeek key', 'QPK', false)
  3. quickpeek_key:set_tooltip('Bind it to a key')
  4. local Shot_fired = 0
  5. local activated_bool = false
  6. local position = nil
  7. local position2 = nil
  8. local position3 = nil
  9. local qp_k_used_counter = 0
  10. local position_checkY = nil
  11. local position_checkX = nil
  12. local activated_bool = false
  13. local m_local = entity_list.get_entity(engine_client.get_local_player())
  14. local test_render = 0
  15. local ScreenTestX
  16. local ScreenTestY
  17.  
  18. function on_player_jump(ev)
  19.  
  20.     -- optional engine_client.exec('say i just jumped')
  21.  
  22. end
  23.  
  24. function on_shot_fired()
  25.  
  26.     Shot_fired = 1
  27.  
  28. end
  29.  
  30. function get_position()  
  31.     test_render = 0                
  32.     local screenX, screenY = -1, -1
  33.     if not activated_bool then
  34.         activated_bool = true
  35.         position = m_local:get_eye_position()
  36.         position = vec3.new(position.x, position.y, position.z - 65)
  37.     end
  38.         local screenX, screenY = renderer.world_to_screen(position)
  39.        
  40.         if screenX ~= -1 then
  41.             renderer.rect(screenX -5, screenY -5, screenX + 5, screenY + 5, color.new(120, 81, 169))
  42.             if Shot_fired == 1 then
  43.                 --return
  44.             end
  45.         end
  46. end
  47.  
  48. function on_paint()
  49.  
  50.     local qp_k_used = quickpeek_key:get_value()
  51.  
  52.     if engine_client.is_ingame() then
  53.        
  54.         if qp_k_used then
  55.        
  56.             get_position()
  57.             qp_k_used_counter = 1
  58.            
  59.         elseif qp_k_used_counter == 1 then --maybe wrong but i am too busy/lazy to check
  60.            
  61.             --if shot_fired
  62.             position2 = m_local:get_eye_position()
  63.             position2 = vec3.new(position2.x, position2.y, position2.z - 65)
  64.             position_check_before_movement_Y = position.y - position2.y            
  65.             position_check_before_movement_X = position.x - position2.x
  66.            
  67.             on_setup_command(cmd)
  68.  
  69.             position3 = m_local:get_eye_position()
  70.             position3 = vec3.new(position3.x, position3.y, position3.z - 65)
  71.  
  72.             position_checkY_after_movement_right_Y = position.y - position3.y            
  73.             position_checkX_after_movement_right_X = position.x - position3.x
  74.  
  75.             if position_check_before_movement_X < position_checkX_after_movement_right_X or position_check_before_movement_Y < position_checkY_after_movement_right_Y then
  76.                
  77.                 --try to move 2x left
  78.                 --checking position after moving left, if the position_check is smaller if not move right and then back etc.....
  79.  
  80.             end
  81.  
  82.             qp_k_used_counter = 0
  83.            
  84.         else
  85.             activated_bool = false
  86.            
  87.         end
  88.     end
  89.  
  90.     if qp_k_used then
  91.    
  92.         if Shot_fired == 1 then
  93.            
  94.             Shot_fired = 0
  95.            
  96.         end
  97.     end
  98. end
  99.  
  100. function on_setup_command(cmd)
  101.  
  102.  
  103.     --error('on_setup_command')
  104.     --cmd:set_button(buttons.right)
  105.     --cmd:unset_button(buttons.right)
  106.  
  107. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement