Forum

> > CS2D > Scripts > Asking for a timer.
Forums overviewCS2D overview Scripts overviewLog in to reply

English Asking for a timer.

5 replies
To the start Previous 1 Next To the start

old Asking for a timer.

Pablotez
User Off Offline

Quote
Hello guys, can someone help me to make a timer in my lua file?
If your answer is yes then listen what I want.

I want create a timer for a round restart that will start with 01:30:00, the round restart will be placed into my map to have a less work.

Thank you,
Caza.

old Re: Asking for a timer.

Rainoth
Moderator Off Offline

Quote
1
timer(time,function,function parameter,repeat count)
What you need is:
1
timer(5400000,"parse","restart")
The code above will restart round after 5400000 milliseconds. If you want it to work when round is restarted before that (for example with a command or if it's not Team Deathmatch/Deathmatch/Construction mode and everyone dies or if all the objectives are completed) you'll have to free the timer every time that happens and set it up again (using startround hook will be needed).

old Re: Asking for a timer.

Pablotez
User Off Offline

Quote
Thank you @user Rainoth: but I still have the same question, I want make a hudtxt up-right of cs2d window but I really have not idea to make it.

old Re: Asking for a timer.

Ajmin
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
max=75 --Modify this to a particular number (calculated as minute default=75 minutes ) 
time_limit=0

addhook("ms100","_ms100")
function _ms100()
for i=1,32 do
parse('hudtxt2 '..i..' 1 "©000255000Auto-Refresh in: '..time_limit..'/'..max..' minutes" 10 425')
end
end



addhook("minute","_end")
function _end()
if time_limit<max then
time_limit=time_limit+1
end
if time_limit==max then
parse("restart 3")
time_limit=0
end
end

Hope i helped
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview