Forum

> > CS2D > General > After mapcycle map starts too fast
Forums overviewCS2D overviewGeneral overviewLog in to reply

English After mapcycle map starts too fast

8 replies
To the start Previous 1 Next To the start

old After mapcycle map starts too fast

Bierbuikje
User Off Offline

Quote
Hello,

I have a problem with my server. If the map changes (like from dust to a map of my own) my players have to load first. That takes like 10 seconds and then they join. But if it is a DM map (no respawn) they can't play for the whole round.

Is there a way to wait (like 10 seconds) after a mapcycle and then start the map (when everyone is done loading)?

Thanks,

Bierbuik

old Re: After mapcycle map starts too fast

DC
Admin Off Offline

Quote
this is a point which will hopefully be improved with one of the next releases.

add this to your sys/lua/server.lua (open with texteditor):
1
2
3
4
5
addhook("second","autorestart")
function autorestart()
	parse("sv_restart 10")
	freehook("second","autorestart")
end

change the 10 to change the restart delay in seconds.

old Re: After mapcycle map starts too fast

Bierbuikje
User Off Offline

Quote
Add it like this?

Option 1
Spoiler >


Or like this?

Option 2
Spoiler >


Thank you

old Re: After mapcycle map starts too fast

DC
Admin Off Offline

Quote
doesn't matter. same result
the second way is "cleaner" though. but you have to remove the -- in front of the related dofile command. (-- = comment = do not execute)

old Re: After mapcycle map starts too fast

DC
Admin Off Offline

Quote
why does EVERYONE switch to pm for no reason?! It's annooooying! use the forum! I'll answer your pm here:
Bierbuikje has written
Hello, i tried to change the minimum time to wait before a map starts.

Well, if i change it to this (20 seconds)

1
2
3
4
5
addhook("second","autorestart")
function autorestart()
     parse("sv_restart 20")
     freehook("second","autorestart")
end

Or this (30 seconds) it doesn't matter, it stays 10 seconds and then the map starts. I would like it waited 20 seconds and then started.

1
2
3
4
5
addhook("second","autorestart")
function autorestart()
     parse("sv_restart 30")
     freehook("second","autorestart")
end

oh I didn't think about that. it probably has a limit.
try this lua code instead:
1
2
3
4
5
6
7
8
9
autorestarttimer=0
addhook("second","autorestart")
function autorestart()
	autorestarttimer=autorestarttimer+1
	if autorestarttimer>=10 then
		parse("sv_restart 10")
		freehook("second","autorestart")
	end
end
(waits 10+10 = 20 seconds)

old Re: After mapcycle map starts too fast

Bierbuikje
User Off Offline

Quote
Well, I wanted to place a new reaction but I had the choice 'edit last post' or 'go back'. And if I edited I knew you would never see it (no update), so I choose for the PM.

The result of your new lua is working. More time left to join now and thats what I was looking for.

Thank you!

old Re: After mapcycle map starts too fast

DC
Admin Off Offline

Quote
this forum is uber awesome and it marks the thread as being new when you edit a post in it. there is even a checkbox for it. so I would have seen it. no need for annoying pms when there is a thread about it
To the start Previous 1 Next To the start
Log in to replyGeneral overviewCS2D overviewForums overview