Forum

> > CS2D > Scripts > Time script
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Time script

10 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Time script

Autumn
User Off Offline

Zitieren
Hi people.I have made time script...
Spoiler >

But I have one problem how to make that time stopped on 0 and did not leave in a minus (-1,-2,-3....)

alt Re: Time script

DC
Admin Off Offline

Zitieren
add "if sample.hudtxt.timer>0 then" to the beginning of the sample.hudtxt.second() function and another "end" to its end.
(btw.: you shouldn't use the sample table for your scripts. it's for samples )

alt Re: Time script

Autumn
User Off Offline

Zitieren
Thanks for the help
But I have 1 more question. How to make that in the beginning of each round the timer was = 60? Because at start of a card the script starts to work for me normally, time reaches to 0 and at a new round the timer is not nulled till 60 seconds. How it to correct?
1× editiert, zuletzt 15.10.11 00:46:31

alt Re: Time script

DC
Admin Off Offline

Zitieren
you have to use the startround hook.

1
2
3
4
addhook("startround","start")
function start()
	sample.hudtxt.timer=60
end

alt Re: Time script

Autumn
User Off Offline

Zitieren
I already tried it, why that does not work. The timer all the same remains on 0

alt Re: Time script

DC
Admin Off Offline

Zitieren
that's impossible. make sure that there is no typo. see what the console says. add prints to make sure that the function is actually called.

alt Re: Time script

Autumn
User Off Offline

Zitieren
The console does not give out errors. I do not understand where there can be an error. Look please at a script.
Spoiler >

alt Re: Time script

DC
Admin Off Offline

Zitieren
the problem is that you overwrite your function:
1
2
function sample.hudtxt.second()
end
it's a bad idea obviously!
replace the 2 lines above with
1
freehook("second","sample.hudtxt.second")

and also add
1
addhook("second","sample.hudtxt.second")
to the start function!

that should fix your problem.
of course you could also have done it the way I suggested (with the >0 condition). would have been much easier

alt Re: Time script

Autumn
User Off Offline

Zitieren
It should look so?
Spoiler >

That I do not understand that

alt Re: Time script

DC
Admin Off Offline

Zitieren
yeah but you forgot my second instruction. the addhook in start part.

alt Thanks

Autumn
User Off Offline

Zitieren
Everything, I have made a script, now it works нормально.Dc, thanks you big)
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht