Forum

> > CS2D > Scripts > Special power when pressing T button only for zomb
Forums overviewCS2D overview Scripts overviewLog in to reply

English Special power when pressing T button only for zomb

10 replies
To the start Previous 1 Next To the start

old Re: Special power when pressing T button only for zomb

Cebra
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
--untested
timeInMillis = 10000
speedmod = 20

addhook("spray","_s")
function _s(id)
	if player(id,"team")==1 then
		parse("speedmod "..id.." "..speedmod)
		timer(timeInMillis,"resetSpeed",id)
	end
end

function resetSpeed(id)
	parse("speedmod "..id.." 0")
end
edited 1×, last 01.11.20 12:31:47 pm

old Re: Special power when pressing T button only for zomb

DX
User Off Offline

Quote
@user Cebra: LUA ERROR: Cannot add 'spray' key bind (key does not exist or is already bound)!
edit:i fix it thx
edit:but i have problem when i press T i can Press T again i want cooldown
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
--untested
timeInMillis = 10000
speedmod = 20

addbind("T")
addhook("key","_s")
function _s(id,key)
	if (key == "T") then
     if player(id,"team")==1 then
          parse("speedmod "..id.." "..speedmod)
          timer(timeInMillis,"resetSpeed",id)
	  end
     end
end

function resetSpeed(id)
     parse("speedmod "..id.." 0")
end
edited 1×, last 01.11.20 12:34:39 pm

old Re: Special power when pressing T button only for zomb

Cebra
User Off Offline

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

speedTime = 10000
cooldownTime = 10000
speedmod = 20
cooldownFlag = initArray(32)

addhook("spray","_s")
function _s(id)
     if player(id,"team")==1 and cooldownFlag[id]==0 then
          parse("speedmod "..id.." "..speedmod)
          cooldownFlag[id] = 1
          timer(timeInMillis,"resetSpeed",id)
     end
end

function resetSpeed(id)
     parse("speedmod "..id.." 0")
     timer(cooldownTime,"resetCooldown",id)
end

function resetCooldown(id)
	cooldownFlag[id] = 0
end
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview