-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathy.a.n.o.s.i.k.txt
More file actions
141 lines (115 loc) · 5.24 KB
/
Copy pathy.a.n.o.s.i.k.txt
File metadata and controls
141 lines (115 loc) · 5.24 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
--@name Y.A.N.O.S.I.K
--@author
--@shared
if SERVER then
local entWeldedToVel = chip():isWeldedTo()
timer.create("S-czej",0.1, 0, function()
if chip():isWeldedTo():getClass() != "gmod_sent_vehicle_fphysics_base" then
error("Na samochodzie to daj")
end
net.start("weldcheck")
net.writeEntity(entWeldedToVel)
net.send()
end)
hook.add("PlayerEnteredVehicle", "pev", function(ply, veh, num)
enableHud(veh:getDriver(), true)
end)
hook.add("PlayerLeaveVehicle", "plv", function(ply, veh)
enableHud(veh:getDriver(), false)
end)
end
if CLIENT then
local vehicle
local vehicleVel = 0
local resX, resY = render.getResolution()
local spdLimit = 50
local drawSign = true
local signFont = render.createFont("DermaLarge", 80, 600, true, nil, nil, nil, nil, nil, nil)
timer.create("C-czej", 0.1, 0, function()
net.receive("weldcheck", function()
vehicle = net.readEntity()
vehicleVel = math.round(vehicle:getLocalVelocity():getLength() * 3600 * 0.0000254)
end)
end)
local boolAlarm = false
timer.create("alarm", 0.276, 0, function()
if boolAlarm then
vehicle:emitSound("buttons/blip2.wav", 75, 110, 1, 0)
end
end)
local radaryDanger = {}
timer.create("radarydanger", 0.1, 0, function()
if table.count(radaryDanger) > 0 then
boolAlarm = true
timer.unpause("alarm")
timer.unpause("pulsatingSign")
else
boolAlarm = false
timer.pause("alarm")
timer.pause("pulsatingSign")
end
end)
hook.add("hudconnected", "HUDConnect", function(ent, ply)
local frameCount = 0
local function drawSign()
render.setColor(Color(255,0,0))
render.drawFilledCircle(resX/5, resY/1.1, 70)
render.setColor(Color(255,255,255))
render.drawFilledCircle(resX/5, resY/1.1, 55)
render.setColor(Color(0,0,0))
render.setFont(signFont)
render.drawText(resX/5.55, resY/1.145, tostring(spdLimit))
end
hook.add("drawhud", "HUD", function()
if frameCount > 60 then
frameCount = 0
end
//push
render.pushViewMatrix({type = "2D"})
//fonty
local plyPos = ply:getPos()
// find in cone todo
local radary = find.byModel("models/maxofs2d/camera.mdl")
for k, radar in ipairs(radary) do
radarClass = radar:getClass()
if radarClass == "prop_physics" or radarClass == "starfall_processor" then
local radarPos = radar:getPos()
local radarPosToScreen = radarPos:toScreen()
local radarDist = math.round(plyPos:getDistance(radarPos))
local radarDistMetric = radarDist * 0.0254
if radarDist <= vehicleVel*spdLimit and vehicleVel > spdLimit then
if table.count(radaryDanger) == 0 then
table.insert(radaryDanger, radar)
end
render.setColor(Color(255,0,0))
render.drawCircle(radarPosToScreen["x"], radarPosToScreen["y"] -5, 67)
render.drawCircle(radarPosToScreen["x"], radarPosToScreen["y"] -5, 70)
render.drawCircle(radarPosToScreen["x"], radarPosToScreen["y"] -5, 73)
render.setFont("DermaLarge")
render.drawText(radarPosToScreen["x"]+90, radarPosToScreen["y"] -5, "RADAR! ZWOLNIJ!", 0)
render.setFont("Trebuchet18")
render.drawText(radarPosToScreen["x"]+15, radarPosToScreen["y"]+10, math.round(radarDistMetric) .. " m", 0)
render.drawText(radarPosToScreen["x"]-60, radarPosToScreen["y"]-40, "Radar " .. k, 0)
else
if table.count(radaryDanger) > 0 then
table.removeByValue(radaryDanger, radar)
end
render.setColor(Color(0,50,255))
render.drawCircle(radarPosToScreen["x"], radarPosToScreen["y"] -5, radarDist/(radarDist*0.05))
render.setFont("Trebuchet18")
render.drawText(radarPosToScreen["x"]+15, radarPosToScreen["y"]+10, math.round(radarDistMetric) .. " m", 0)
render.drawText(radarPosToScreen["x"]-60, radarPosToScreen["y"]-40, "Radar " .. k, 0)
end
end
end
if boolAlarm and frameCount <= 30 then
drawSign()
elseif !boolAlarm then
drawSign()
end
render.popViewMatrix()
//pop
frameCount = frameCount + 1
end)
end)
end