Forum

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

English round restart script need fix

6 replies
To the start Previous 1 Next To the start

old round restart script need fix

haha1955
User Off Offline

Quote
addhook("startround","rnd_xx")
addhook("join","rnd_xx")

round = 0
function rnd_xx(id)
round = round + 1
     if (round > 20) then
parse("restart 0")
round = 0
end
parse('hudtxt 188 "'..hc.YELLOW..'Round: '..hc.WHITE..''..tostring(round)..'/20 "0 218 0')
end



if every time one player join in the server, then round is 1+
sample we are in round 1, any player joined then is round 2, one more player is joined then round 3, please help me for fix that.

old Re: round restart script need fix

TrialAndError
User Off Offline

Quote
Then seperate the hudtxt and have startround do it's thing and the join hook its thing. And then you can call a function that handles your hudtxt rendering.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
addhook("startround","hook_Startround")
addhook("join","hook_Join")

local currentRound = 0
local maxRound = 20

local function renderHudtxt()
  parse('hudtxt 188 "'..hc.YELLOW..'Round: '..hc.WHITE..''..currentRound..'/'..maxRound..'" 0 218 0')
end

function hook_Startround(mode)
  currentRound = currentRound + 1
  if currentRound > maxRound then
    currentRound = 0
    parse("restart 0")
  end
  renderHudtxt()
end

function hook_Join(id)
  renderHudtxt()
end
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview