Forum

> > CS2D > Scripts > Round restar while no body join T?
Forums overviewCS2D overview Scripts overviewLog in to reply

English Round restar while no body join T?

5 replies
To the start Previous 1 Next To the start

old Round restar while no body join T?

-DIE Wolf-
User Off Offline

Quote
Hey! Help me LUA scripts like: If player in team 1 = 0 then Round restart!
I need it because in ZM gamemode, sometimes no one in ZM team and all CT have to wait endround to restart!
I'm bad English. So if u dont understand, post to me!

old Re: Round restar while no body join T?

Gajos
BANNED Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
zm = {}
addhook('second','zm.second')
zm.second = function()
	zm.t = {}
	zm.ct = {}
	for _, id in pairs(player(0,'table')) do
		if player(id,'team') == 1 then
			table.insert(zm.t,id)
		elseif player(id,'team') == 2 then
			table.insert(zm.ct,id)
		end
	end
	if #zm.t == 0 then
		parse('maket '..zm.ct[math.random(1,#zm.ct)])
		parse('restart')
	end
end

old Re: Round restar while no body join T?

Alistaire
User Off Offline

Quote
Dude don't use a second hook for everything. Also;

1
2
3
4
5
6
7
8
9
10
11
12
addhook('leave', 'teamchange')
addhook('team', 'teamchange')

function teamchange()
	local a = player(0, 'team1')
	if a[1] < 1 or a[1] > 32 then
-- I actually don't know what it returns if there's no terrorists. Possibly 0 or so?
		parse('restart')
		local b = player(0, 'team2')
		parse('maket '..b[math.random(1, #b])
	end
end

----

I think it's even impossible to have no T in Standard, Zombie, Construction and Team Deathmatch. So I guess you're talking about Deathmatch.

old Re: Round restar while no body join T?

Gajos
BANNED Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
if zm == nil then zm = {} end
addhook('leave','zm.leave')
addhook('team','zm.team')

zm.leave = function(id)
	if player(id,'team') == 1 then
		zm.reload(id)
	end
end

zm.team = function(id)
	if player(id,'team') == 1 then
		zm.reload(id)
	end
end

zm.reload = function(id)
	local t, ct = player(0,'team1'), player(0,'team2')
	if #t == 0 then
		parse('maket '..math.random(1,#ct))
		parse('restart')
	end
end
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview