Forum

> > CS2D > Scripts > LUA SCRIPT- for competitive mode
Forums overviewCS2D overview Scripts overviewLog in to reply

English LUA SCRIPT- for competitive mode

30 replies
Page
To the start Previous 1 2 Next To the start

old Re: LUA SCRIPT- for competitive mode

Andrez
User Off Offline

Quote
yes i got some ideas with the colors (depending on money)

around 800 red

around 2000 yellow

around 3100 green

(those values are very important to decide if buy or not)

old Re: LUA SCRIPT- for competitive mode

Cure Pikachu
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
function updateHudtxt(id,pl)
	local x, y = player(pl,'x') - player(id,'x') + 320, player(pl,'y') - player(id,'y') + 200
	local c
	if player(pl,"money") >= 3100 then
		c = "©000255000"
	elseif player(pl,"money") >= 2000 and player(pl,"money") < 3100 then
		c = "©255255000"
	else
		c = "©255000000"
	end
	parse('hudtxt2 '..id..' '..pl..' "'..c..'$'..player(pl,'money')..'" '..x..' '..y..' 1')
end
Just update the updateHudtxt function with the code above and you are set.

old Re: LUA SCRIPT- for competitive mode

Gaios
Reviewer Off Offline

Quote
I got this problem. The hudtxt(s) doesn't disappear when somebody spawn himself and buy item after startround.
Anyway this code isn't cool for me . Maybe I will release this script with some improves. Also I did share this script for PCS, I don't know why are you asking for that bugfix user mrc, I'm not forced for that.
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
------------------------------------------
-- 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 and gajos.containUser(pl) then
               timer(50,'parse','lua updateHudtxt('..id..','..pl..')')
          end
     end
end

function gajos.containUser(pl)
	for _, id in pairs(gajos.tableLiving) do
		if id == pl then
			return true
		end
	end
	return false
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

old Re: LUA SCRIPT- for competitive mode

Gaios
Reviewer Off Offline

Quote
It's fixed. I'm here to help people, it's like I don't play games for fun. Also this code doesn't have the hudtxt coloring.
user Gaios has written
Maybe I will release this script with some improves.

Unless somebody will do edit my script (I allow right now) and will release it here faster.

EDIT: No, somebody already released the Hudtxt function.
edited 1×, last 28.11.15 11:28:56 am
To the start Previous 1 2 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview