Force the Round to End

Hi i’m an extreme lua noob and i’m having trouble setting up the end of the round for my gamemode. Basically i’m trying to set it up so that if one team still has players by the end of the timer then that team wins but if that team runs out of players it would force end the round. The problem is that its not working at all and giving errors in the console. Here is the code:

function GM:roundEnd()
	if CurTime() == 0 and team.NumPlayers(1) >= 1 then
		PrintMessage(HUD_PRINTTALK, "Survivors Win!")
	elseif team.NumPlayers(1) == 0 then
		PrintMessage(HUD_PRINTTALK, "Zombies Win!")
		CurTime() = 0

I am using the round system found here
Could anyone tell me what i’m doing wrong and how i can fix it? Thanks.

What errors are being given in console?

[ERROR] gamemodes/infection/gamemode/roundsystem.lua:188: unexpected symbol near '='

line 188:

 		CurTime() = 0

Curtime is a function to return something, you cannot set it like that.

That code doesn’t even make sense. What exactly are you trying to do?

CurTime() is a function that, to put it simply, returns the time since server start. It will only be 0 at the very moment your launch the game. You will need to set a variable to the time you wish for the round to stop (by doing “variable = CurTime() + seconds”) and then check if the new CurTime() is higher than “variable”. You will also need to hook this so that it checks every tick.

Alternatively, use timer.Create with the set time, and at the end run the Humans Win function. Then hook on to OnPlayerChangedTeam and check if that’s all humans gone and run a Zombies Win function. This is probably the better approach.