Forum
CS2D Scripts Bot join scriptBot join script
8 replies 1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
bots = {} addhook("join","count") function count(id) 	if bots>0 then 		parse("kick "..bots[#bots)]) 	end 	if player(id,"bot") then 		table.insert(bots,id) 	end end addhook("leave","add") function add(id) 	if player(id,"bot") then 		table.remove(bots,#bots) 	else 		parse("bot_add") 	end end
edited 1×, last 26.02.12 11:12:07 am
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
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
mbots = 4 bots = {} for i=1,mbots do 	parse("bot_add") 	table.insert(bots,player(0,"table")[#player(0,"table")]) end function countplayers() 	local c=0 	for _,i in pairs(player(0,"table")) do 		if not player(i,"bot") then 			c=c+1 		end 	end 	return c end addhook("join","checkbots") function checkbots() 	if bots>0 then 		parse("kick "..bots[#bots]) 	end end addhook("leave","checkbots2") function checkbots2() 	local ply=countplayers() 	if ply<mbots then 		parse("bot_add") 	end end
I think this should work.
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
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
bots = 1 addhook('ms100','bot_ms100') function bot_ms100() humans = 0 bot_count = 0 	for i = 1,32, 1 do 		if (player(i,'exists')) and (player(i,'bot') == false) then 			humans = humans + 1 		end 	end 	 	for l = 1,32, 1 do 		if (player(l,'exists')) and (player(l,'bot') == true) then 			bot_count = bot_count + 1 		end 	end 		 	if (humans < 2) and (bot_count < bots) then 		for j = 1,bots, 1 do 			parse('bot_add') 		end 	end 	if (humans >= 2) then 	parse('bot_remove') 	end end
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
addhook("leave","_leave") addhook("log","_log") function _log(text) 	if string.sub(text,1,22)=="recv join attempt... (" then 		parse("bot_remove") 	end end function _leave(id) 	for i=1,game("sv_maxplayers")-#player(0,"table")+1 do 		timer(100,"parse","bot_add") 	end end for i=1,game("sv_maxplayers")-#player(0,"table") do 	parse("bot_add") end
settings: bots = 15
edited 1×, last 27.02.12 06:11:54 pm
1