1
2
3
4
5
6
7
8
shotgunPlayers = math.floor(playersLiving * 0.333)
deaglePlayers = math.floor(playersLiving * 0.166)
meleePlayers = math.floor(playersLiving * 0.5)
-- fill one group in case of bad rounding
if (shotgunPlayers + deaglePlayers + meleePlayers) < playersLiving then
	meleePlayers = meleePlayers + 1
end
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
-- team 1 or 2 living
local teamliving = player(0,"team1living")
-- execute as often as many shotgun kits will be given
for i = 1, shotgunPlayers do
	local randomkey = math.random(1, #teamliving)	-- random key inside that table
	local pid = teamliving[ randomkey ]	-- e.g. teamliving[3], 3rd player in this table
	local wid = 88	-- weapon id
	
	parse("equip ".. pid .." ".. wid)
	
	table.remove(teamliving, randomkey)	-- remove this player from table
end
-- same for deagle
for i = 1, deaglePlayers do
	local randomkey = math.random(1, #teamliving)	-- random key inside that table
	local pid = teamliving[ randomkey ]	-- e.g. teamliving[3], 3rd player in this table
	local wid = 3	-- weapon id
	
	parse("equip ".. pid .." ".. wid)
	
	table.remove(teamliving, randomkey)	-- remove this player from table
end
-- same for armor + machete, add armor yourself
for i = 1, meleePlayers do
	local randomkey = math.random(1, #teamliving)	-- random key inside that table
	local pid = teamliving[ randomkey ]	-- e.g. teamliving[3], 3rd player in this table
	local wid = 69	-- weapon id
	
	parse("equip ".. pid .." ".. wid)
	
	table.remove(teamliving, randomkey)	-- remove this player from table
end
With this code you're guaranteed to equip a certain amount of people with different kits. Each player is randomly picked.