Forum

> > CS2D > Scripts > Timer
Forums overviewCS2D overview Scripts overviewLog in to reply

English Timer

4 replies
To the start Previous 1 Next To the start

old Timer

Mami Tomoe
User Off Offline

Quote
Hi! I need help

This is a function
1
2
3
4
5
function unmute(pl)
	local pl=tonumber(pl)
	rp_muted[pl]=false
	rp_msg2(pl,rgbcolor.green,"["..script_name.."]: "..rgbcolor.yellow.."You are no longer muted.")
end

This is a timer
1
2
3
4
5
6
7
8
9
10
11
12
if time==1 then
								time=60000
							elseif time==2 then
								time=120000
							elseif time==3 then
								time=180000
							elseif time==4 then
								time=240000
							elseif time==5 then
								time=300000
							end
							timer(time,"unmute",pl)

When I call the timer with a !mute <id> 1 (for 1 minute) it should go to milliseconds so its 60000 but I waited a lot (a lot) minutes and I still not unmuted?? Why I not unmuted?

Please help me!!

old Re: Timer

RedizGaming
GAME BANNED Off Offline

Quote
you can try to do not use same var "time - time"

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
for id = 1,32 do
	times[id] = 0
end

if time == 1 then
	times[id] = 60000
elseif time == 2 then
	times[id] = 120000
elseif time == 3 then
	times[id] = 180000
elseif time == 4 then
	times[id] = 240000
elseif time == 5 then
	times[id] = 300000
end
timer(times[id],"unmute",pl)

something like this ?

old Re: Timer

Mami Tomoe
User Off Offline

Quote
This can't be it it has to be something else because I used something like that before

mstime and time

old Re: Timer

Bowlinghead
User Off Offline

Quote
Do sth like this:
1
2
3
4
5
6
addhook("serveraction","myAc")
function myAc(id,b)
	if b==1 then
		unmute(2)
	end
end
Or similiar to save some time.

Does the unmute function work properly?

And you could save some code by writing:
1
time = (60000 * time)


You use the rp_msg2 function like this:
rp_msg2(pl, color, text)
I dont know if this comma is intended!

old Re: Timer

Mami Tomoe
User Off Offline

Quote
More >


NVM I just use my own timer using second hook
edited 3×, last 02.04.17 09:13:34 am
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview