Forum

> > CS2D > Scripts > Sound Around Player
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Sound Around Player

4 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Sound Around Player

Ghost-Rider
BANNED Off Offline

Zitieren
Play sound around player?
hi i wanna make a script for my server
when i sit onto polie car and i write command into chat(!siren)
the sound will be played around a player.

alt Re: Sound Around Player

Avo
User Off Offline

Zitieren
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
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht