Forum

> > CS2D > Scripts > countdown hud
Forums overviewCS2D overview Scripts overviewLog in to reply

English countdown hud

1 reply
To the start Previous 1 Next To the start

old countdown hud

DX
User Off Offline

Quote
hi i want added a countdown to my script but idk how to make it
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
function initArray(m)
	local array = {}
	for i = 1, m do
		array[i]=0
	end
	return array
end
spray=initArray(32)

function sspray(id)
	parse('hudtxt2 '..id..' 0 "©255255255spray: '..spray[id]..' " 13 200')
end

addhook("kill","kill")
function kill(id)
	if player(id,"team")==2 then
		spray[id]=spray[id]+1
		sspray(id)
	end
end

addhook("spawn","spawn")
function spawn(id)
	sspray(id)
end

addhook("spray","spray")
function spray(id)
	if spray[id]>0 then
		parse("speedmod "..id.." 30")
		timer(10000,"parse","speedmod "..id.." 0")
		spray[id]=spray[id]-1
		sspray(id)
	else
		msg2(id,"©255000000Not enough spray!")
	end
end
if i press the spray it will bring up a countdown until i can press the spray again

old Re: countdown hud

Cebra
User Off Offline

Quote
dont kown if this work, but maybe it inspires you

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
function initArray(m)
     local array = {}
     for i = 1, m do
          array[i]=0
     end
     return array
end
spray=initArray(32)

cooldown = initArray(32)

function sspray(id)
     parse('hudtxt2 '..id..' 0 "©255255255spray: '..spray[id]..' " 13 200')
end

addhook("kill","kill")
function kill(id)
     if player(id,"team")==2 then
          spray[id]=spray[id]+1
          sspray(id)
     end
end

addhook("spawn","spawn")
function spawn(id)
     sspray(id)
end

addhook("spray","spray")
function spray(id)
     if spray[id]>0 and cooldown==0 then
          parse("speedmod "..id.." 30")
          timer(10000,"parse","speedmod "..id.." 0")
          spray[id]=spray[id]-1
          sspray(id)

          cooldown[id] = 10
          timer(1000, countdown, id)

     else
          msg2(id,"©255000000Not enough spray!")
     end
end

-- untested
function countdown(id)
     parse('hudtxt2 '..id..' 1 "'..cooldown[id]..' " 13 200')
     cooldown[id] = cooldown[id] - 1
     if cooldown[id] > 0 then
          timer(1000, countdown, id)
     end
end
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview