Page 1 of 1

Possible to make change gametype script when certain # join?

Posted: Tue Jan 15, 2008 5:30 pm
by SkiLLeT
I have a mod that does not work will below five players. Is it possible to make a looping script that detects how many players are in the server, and when the desired number is reached the game restarts and changes gametype? Is there some mod out there that detects how many players are in a server? I know there might be, but I'm clueless right now. Maybe I could look at that code.

Posted: Tue Jan 15, 2008 8:00 pm
by ViPER
On my server custom maps are voteable - The default rotation is stock maps however and I use this to check during custom rotations if the server is empty and the map is custom it will switch to stock rotation.

I recomend that you simply change the gametype and it will take effect on the next map - that way you are not constantley disrupting the gameplay. You could also make it check the lower threshold of players to switch it back to normal play.


Code: Select all

main:

//////////////////////////////////////
	level waittill prespawn
//////////////////////////////////////

//////////////////////////////////////
	level waittill spawn
//////////////////////////////////////

thread emptyserver_check

end

emptyserver_check:

wait 50

thread peepscounter

wait 10

 if(int(getcvar "totalpeeps" == "0"))
	{
	setcvar "nextmap" "vstr x1"
	local.t = 1
	setcvar timelimit local.t
	wait 10
	setcvar g_gametype 4
	teamwin allies
	}

goto emptyserver_check

peepscounter: 
println ("Counting")
if($player.size > 0) 
setcvar totalpeeps $player.size 
else 
setcvar totalpeeps 0 
end