Forum

> > CS2D > Scripts > LUA SCRIPT- for competitive mode
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch LUA SCRIPT- for competitive mode

30 Antworten
Seite
Zum Anfang Vorherige 1 2 Nächste Zum Anfang

alt Re: LUA SCRIPT- for competitive mode

Andrez
User Off Offline

Zitieren
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)

alt Re: LUA SCRIPT- for competitive mode

Cure Pikachu
User Off Offline

Zitieren
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.

alt Re: LUA SCRIPT- for competitive mode

Gaios
Reviewer Off Offline

Zitieren
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

alt Re: LUA SCRIPT- for competitive mode

Gaios
Reviewer Off Offline

Zitieren
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 hat geschrieben
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.
1× editiert, zuletzt 28.11.15 11:28:56
Zum Anfang Vorherige 1 2 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht