Jump to content

g_shuffle_staytime or something?


Chuckun

Recommended Posts

I am requesting a new shuffle server cvar to prevent players from switching teams until after a predifined period of time..

 

For example, g_shuffle_staytime 300 would prevent players from switching teams until 5 minutes after any shuffle (be it via shrubbot command or auto shuffle).

 

This would be SO helpful.

 

If this were to be implemented, it should not affect !putteam, as there are occasions where people DO need to move soon after a shuffle (if a player leaves for example), but dealing with this manually would be so much better than dealing with all the team stackers we have every day..

 

Could it be implemented?

 

If you need any extra infos I will be stalking so feel free to ask :)

Edited by Chuckun
Link to comment
Share on other sites

MINIMAL_LEVEL_TOEXECUTE	= 20			-- minimal level to execute this command
SHUFFLE_COMMAND			= "!shuffle"	-- shuffle command
SHUFFLE_AFTERTIME		= 5*60			-- 5min

Client = { }

function et_InitGame( levelTime, randomSeed, restart ) 
	maxclients = et.trap_Cvar_Get( "sv_maxclients" ) 
end

function et_ClientCommand( num, cmd )
	local arg0 = string.lower(cmd)
	local arg1 = string.lower(et.trap_Argv(1))
	
	if et.G_shrubbot_level( num ) >= MINIMAL_LEVEL_TOEXECUTE and arg0 == SHUFFLE_COMMAND or arg1 == SHUFFLE_COMMAND then
		StartTime = os.time()
		for i = 0, maxclients - 1 do
			local team = et.gentity_get(i, "sess.sessionTeam")
			if team ~= 3 then
				Client[i] = team
			end
		end
		return true	-- let execute it
	end
	
	if arg0 == "team" and StartTime ~= nil then
		if arg1 == "b" then
			if os.time() >= (StartTime + SHUFFLE_AFTERTIME) and Client[num] == 1 then
				return false
			end
		elseif arg1 == "r" then
			if os.time() >= (StartTime + SHUFFLE_AFTERTIME) and Client[num] == 2 then
				return false
			end
		end
	end
end

It is just concept but it should works, in this case they won't be able to change to ->spec-> another team too

Edited by solaЯ
Link to comment
Share on other sites

MINIMAL_LEVEL_TOEXECUTE	= 20			-- minimal level to execute this command
SHUFFLE_COMMAND			= "!shuffle"	-- shuffle command
SHUFFLE_AFTERTIME		= 5*60			-- 5min

Client = { }

function et_InitGame( levelTime, randomSeed, restart ) 
	maxclients = et.trap_Cvar_Get( "sv_maxclients" ) 
end

function et_ClientCommand( num, cmd )
	local arg0 = string.lower(cmd)
	local arg1 = string.lower(et.trap_Argv(1))
	
	if et.G_shrubbot_level( num ) >= MINIMAL_LEVEL_TOEXECUTE and arg0 == SHUFFLE_COMMAND or arg1 == SHUFFLE_COMMAND then
		StartTime = os.time()
		for i = 0, maxclients - 1 do
			local team = et.gentity_get(i, "sess.sessionTeam")
			if team ~= 3 then
				Client[i] = team
			end
		end
		return true	-- let execute it
	end
	
	if arg0 == "team" and StartTime ~= nil then
		if arg1 == "b" then
			if os.time() >= (StartTime + SHUFFLE_AFTERTIME) and Client[num] == 1 then
				return false
			end
		elseif arg1 == "r" then
			if os.time() >= (StartTime + SHUFFLE_AFTERTIME) and Client[num] == 2 then
				return false
			end
		end
	end
end

It is just concept but it should works, in this case they won't be able to change to ->spec-> another team too

 

 

Sweeeet thank you :D Now to try get our server admin while he has a moment to integrate it :P

Edited by Chuckun
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...