Forum

> > CS2D > Scripts > Hurt every 2 seconds?
Forums overviewCS2D overview Scripts overviewLog in to reply

English Hurt every 2 seconds?

2 replies
To the start Previous 1 Next To the start

old Hurt every 2 seconds?

Dovahkin
User Off Offline

Quote
I've been wondering on how do you make the second hook to actually make it 2 seconds?

For example :
1
2
3
4
5
6
7
8
addhook("second","decay")
function decay()
	for id=1,32 do
		if player(id,"exists") then
			parse("sethealth "..id.." "..player(id,"health")-1)
		end
	end
end

How do I make the players hurt every 2 seconds or more seconds?

old Re: Hurt every 2 seconds?

_oops
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
cnt=0
max_cnt=2 --  you can change here for more second 

addhook("second","_sec")
function _sec()
cnt=cnt+1
 if cnt==max_cnt then
 cnt=0
  for k,v in pairs(player(0,"tableliving")) do
  parse("sethealth "..v.." "..player(v,"health")-1)
  end
 end
end
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview