Advertisement
zs13213134

Untitled

Mar 19th, 2019
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.66 KB | None | 0 0
  1. local ui_ref, ui_new_slider, ui_new_checkbox, ui_get, ui_set, client_set_event_callback, entity_get_prop, globals_maxplayers, entity_is_enemy, entity_is_alive, entity_is_dormant, client_userid_to_entindex, ui_is_menu_open = ui.reference, ui.new_slider, ui.new_checkbox, ui.get, ui.set, client.set_event_callback, entity.get_prop, globals.maxplayers, entity.is_enemy, entity.is_alive, entity.is_dormant, client.userid_to_entindex, ui.is_menu_open
  2. local ui_playerlist = ui_ref("PLAYERS", "Players", "Player list")
  3. local ui_resetall = ui_ref("PLAYERS", "Players", "Reset all")
  4. local ui_bodyaim = ui_ref("PLAYERS", "Adjustments", "Override prefer body aim")
  5. local ui_checkbox = ui_new_checkbox("RAGE", "Other", "Body aim if slow-walking")
  6. local ui_slider = ui_new_slider("RAGE", "Other", "Slow-walk threshold", 1, 250, 100)
  7.  
  8. client_set_event_callback("paint", function(c)
  9.     if ui_get(ui_checkbox) or ui_is_menu_open() then
  10.         for i = 1, globals_maxplayers() do
  11.             if not entity_is_dormant(i) and entity_is_enemy(i) and entity_is_alive(i) then
  12.                 ui_set(ui_playerlist, i)
  13.                 velocity = { entity_get_prop(i, "m_vecVelocity") }
  14.                 velocity2d = math.sqrt(velocity[1]^2 + velocity[2]^2)
  15.                 if velocity2d <= ui_get(ui_slider) and velocity2d >= 1 then
  16.                     ui_set(ui_bodyaim, "On")
  17.                 else
  18.                     ui_set(ui_bodyaim, "-")
  19.                 end
  20.             end
  21.         end
  22.     end
  23. end)
  24.  
  25. client_set_event_callback("cs_game_disconnected", function(c)
  26.     ui_set(ui_resetall, true)
  27. end)
  28.  
  29. client_set_event_callback("game_newmap", function(c)
  30.     ui_set(ui_resetall, true)
  31. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement