Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local eye_pos1 = {}
- client.add_callback(
- "on_shot",
- function(shot)
- if shot.result ~= nil then
- eye_pos = entitylist.get_local_player():get_origin()
- eye_pos1[#eye_pos1 + 1] = {p_x = eye_pos.x, p_y = eye_pos.y, p_z = eye_pos.z + offset, a = 255}
- end
- end
- )
- events.register_event(
- "bullet_impact",
- function(e)
- if engine.get_player_for_user_id(e:get_int("userid")) == engine.get_local_player_index() then
- bullet_x, bullet_y, bullet_z = e:get_float("x"), e:get_float("y"), e:get_float("z")
- end
- end
- )
- local function trace()
- if entitylist.get_local_player() == nil then
- return
- end
- offset = entitylist.get_local_player():get_prop_float("CBasePlayer", "m_vecViewOffset[2]")
- for i, b in pairs(eye_pos1) do
- if b.a > 0 then
- b.a = b.a - 1
- local p2s = render.world_to_screen(vector.new(b.p_x, b.p_y, b.p_z))
- local w2s = render.world_to_screen(vector.new(bullet_x, bullet_y, bullet_z))
- if w2s.x == 0 and w2s.y == 0 then
- goto continue
- end
- if p2s.x == 0 and p2s.y == 0 then
- goto continue
- end
- render.draw_line(p2s.x, p2s.y, w2s.x, w2s.y, color.new(179, 255, 0, b.a))
- ::continue::
- else
- eye_pos1[i] = nil
- end
- end
- end
- client.add_callback("on_paint", trace)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement