Forum

> > CS2D > Scripts > round restart script need fix
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch round restart script need fix

6 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt round restart script need fix

haha1955
User Off Offline

Zitieren
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.

alt Re: round restart script need fix

TrialAndError
User Off Offline

Zitieren
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
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht