Forum

> > CS2D > Scripts > round restart script
Forums overviewCS2D overview Scripts overviewLog in to reply

English round restart script

10 replies
To the start Previous 1 Next To the start

old Re: round restart script

GeoB99
Moderator Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
local Rounds = 0

function RoundCountRestart(mode)
   if ( mode == 1 or mode == 20 or mode == 30 ) then
      Rounds = Rounds + 1
      if ( Rounds == 15 ) then
         parse('restart 0')
         msg('The Terrorist team has won the match! Restarting...')
      end
   elseif ( mode == 2 or mode == 21 or mode == 22 or mode == 31 ) then
      Rounds = Rounds + 1
      if ( Rounds == 15 ) then
         parse('restart 0')
         msg('The Counter-Terrorist team has won the match! Restarting...')
      end
   end
end

addhook('endround', 'RoundCountRestart')
Didn't test it but should work flawlessly. By the way, care to elaborate what's the HUD in the screen supposed to be? A round counter? Time countdown? If not, then what?

old Re: round restart script

GeoB99
Moderator Off Offline

Quote
The Code >

I chose cs2d lua hook second for performance reasons. Wouldn't make much sense to use cs2d lua hook always or cs2d lua hook ms100.

old Re: round restart script

THEMUD
User Off Offline

Quote
The mere problem with @user GeoB99's code is that it initiates an immediate restart when the round ends, which leads to refuse the restart and continue and hence the
CurrentRounds
keeps getting increased.

So I fixed that and I somehow shortened the code a bit, so it looks like this:
More >


I also added the line 21 to set the
current
to 0 in case if an administrator or a highly prioritized player force restarts the round.
edited 1×, last 15.01.17 11:22:19 pm

old Re: round restart script

THEMUD
User Off Offline

Quote
Image, click me! Do you mean like this?
More >

Notice that you have to put your image's name on line 4, otherwise it will give an error.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview