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
siren={}
for i=1,32 do siren[i]=0 end
function distance(x1,y1,x2,y2)
return math.floor(math.sqrt(math.pow(x1-x2,2)+math.pow(y1-y2,2)))
end
addhook("say","OnSay")
function OnSay(id,txt)
if txt=="!siren" then
if siren[id]==1 then siren[id]=0 else siren[id]=1 end
end
end
addhook("second","EverySecond")
function EverySecond()
for _,id in pairs(player(0,"tableliving")) do
if siren[id]==1 then
for _,ID in pairs(player(0,"tableliving")) do
if distance(player(id,"x"),player(id,"y"),player(ID,"x"),player(ID,"y"))<=500 then
parse('sv_sound2 '..ID..' "env/alarm.wav"')
end
end
end
end
end