Forum

> > CS2D > Scripts > Zombie Team Balance
Forums overviewCS2D overview Scripts overviewLog in to reply

English Zombie Team Balance

3 replies
To the start Previous 1 Next To the start

old Zombie Team Balance

Baloon
GAME BANNED Off Offline

Quote
Well, I make this thread to ask someone else who can fix this as well I imagine it.

If the zombie team is empty, one of survivors will be switched to zombie randomly.
1
2
3
4
5
6
7
8
9
10
addhook("second","checkzombie")
function checkzombie()
 for _,id in ipairs(player(0,"team2"))
  local zombies=player(0,"team1")
  if zombies<=0 then
   parse("maket "..id)
   break
  end
 end
end

It's not like I imagine well, it's not randomly. May someone give me the code?

old Re: Zombie Team Balance

Talented Doge
User Off Offline

Quote
if not next(player(0, "team1"))

Check if team 1 is empty with this.

1
2
3
4
5
6
7
8
addhook("second","sss")

function sss()
	if not next(player(0, "team1")) and next(player(0, "team2")) then
		local a = math.random(1, #player(0, "team2"))
		msg(player(a, "name"))
	end
end

Set
math.randomseed
to os.time() if you are aware of it not being random enough. That will require a bit more work.
edited 1×, last 10.08.16 12:27:47 pm
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview