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
------------------------------------------
-- Show Money for PCS by Gajos (#18271) --
------------------------------------------
gajos = {}
gajos.huds = {}
for i = 1,32 do
	gajos.huds[i] = {}
end
addhook('startround','gajos.startround',42)
function gajos.startround()
	local freezeTime = tonumber(game('mp_freezetime')) or 0
	if freezeTime > 1 then
		gajos.tableLiving = player(0,'tableliving')
		for _, id in pairs(gajos.tableLiving) do
			for _, pl in pairs(gajos.tableLiving) do
				if player(id,'health') > 0 and player(pl,'health') and player(id,'team') == player(pl,'team') and id ~= pl then
					updateHudtxt(id,pl,x,y)
					table.insert(gajos.huds[id],pl)
				end
			end
		end
		addhook('buy','gajos.buy',42)
		timer((freezeTime - 1) * 1000,'removeHudtxts')
	end
end
function gajos.buy(pl)
	for _, id in pairs(gajos.tableLiving) do
		if player(id,'team') == player(pl,'team') and id ~= pl then
			timer(50,'parse','lua updateHudtxt('..id..','..pl..')')
		end
	end
end
function updateHudtxt(id,pl)
	local x, y = player(pl,'x') - player(id,'x') + 320, player(pl,'y') - player(id,'y') + 200
	parse('hudtxt2 '..id..' '..pl..' "©000255000$'..player(pl,'money')..'" '..x..' '..y..' 1')
end
function removeHudtxts()
	freehook('buy','gajos.buy')
	for _, id in pairs(gajos.tableLiving) do
		for k, i in pairs(gajos.huds[id]) do
			parse('hudtxtalphafade '..id..' '..i..' 1000 0')
		end
		gajos.huds[id] = {}
	end
	gajos.tableLiving = nil
end