-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrue_crosshair.txt
64 lines (47 loc) · 1.43 KB
/
true_crosshair.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
--@name True Crosshair
--@author legokidlogan
--@shared
-------------------------------------------------
local crossColor = Color( 255, 255, 0 )
local lineLength = 5
local lineGap = 5
local doCross = true
local circleColor = Color( 255, 0, 0 )
local radius = 8
local doCircle = true
-------------------------------------------------
if SERVER then
hook.add( "PlayerSay", "LKL_TrueCrosshair_Toggle", function( ply, msg )
--if player() ~= owner() then return end
if msg ~= "/tc" then return end
net.start( "LKL_TrueCrosshair_Toggle" )
net.send( ply )
return ""
end )
return
end
local off1 = lineGap
local off2 = lineGap + lineLength
local active = true
hook.add( "drawhud", "LKL_TrueCrosshiar_Render", function()
if not active then return end
local pos = player():getEyeTrace().HitPos
local scrPos = pos:toScreen()
if not scrPos.visible then return end
local x = scrPos.x
local y = scrPos.y
if doCircle then
render.setColor( circleColor )
render.drawCircle( x + 1, y + 1, radius )
end
if doCross then
render.setColor( crossColor )
render.drawLine( x, y + off1, x, y + off2 )
render.drawLine( x, y - off1, x, y - off2 )
render.drawLine( x + off1, y, x + off2, y )
render.drawLine( x - off1, y, x - off2, y )
end
end )
net.receive( "LKL_TrueCrosshair_Toggle", function()
active = not active
end )