Quin | 2009-05-05 21:54
AutoBot
40
points ]
 (11 votes)
Try to balance players on a Cube 2 server

This script attempts to maintain a player balance on an online server automatically.

Usage:

  • Add `exec autobot.cfg` to your autoexec.cfg
  • Claim master on any online server
  • Type `/autobot <num>` where num is the number of players to balance (optional)
  • Relax and let the script manage balancing for you :)
  • To turn off, type `/autobot 0`

Preview:

maxautobot = 8 // maximum number of bots we can add
balautobot = 8 // attempt to keep this many players

runautobot = [
	cln = (listclients 1)
	bot = 0; ppl = 0
	loop i (listlen $cln) [
		num = (at $cln $i)
		if (= (isspectator $num) 0) [
			ppl = (+ $ppl 1)
			if (strcmp (getclientname $num) bot) [ // not ideal, but it works
				bot = (+ $bot 1)
			]
		]
	]
	if (> $balautobot 0) [
		amt = (- $balautobot $ppl)
		if (> $amt 0) [
			if (> (+ $bot $amt) $maxautobot) [ amt = (- $maxautobot $bot) ]
			if (mod (+ $ppl $amt) 2) [ amt = (- $amt 1) ]
			if (> $amt 0) [ loop i $amt [ addbot ] ]
		] [
			amt = (- 0 $amt)
			if (> $amt 0) [
				if (> $amt $bot) [ amt = $bot ]
				if (mod (- $ppl $amt) 2) [ amt = (+ $amt 1) ]
				if (> $amt 0) [ loop i $amt [ delbot ] ]
			]
		]
	] [
		if (> $bot 0) [ loop i $bot [ delbot ] ]
	]
]

doautobot = [
	runautobot
	if (&& (= $balautobot $arg1) (> $balautobot 0)) [
		sleep 1000 [ doautobot $balautobot ] // rinse, repeat
	]
]

autobot = [
	if (> $numargs 0) [ balautobot = $arg1 ]
	doautobot $balautobot
]
autobot.cfg (1.5 KB)
40
points
 (11 votes)
User login
Users on Quadropolis
1 guest & no users online
7YearBitch
Created 2019-03-07 23:20
3 hours 46 min ago
Ao1 Pointblank
Created 2019-03-04 15:01
3 days 12 hours ago
84
points ]
 (9 votes)
Created 2010-07-21 06:51
8 years 33 weeks ago
Ao1 Pointblank
81
points ]
 (9 votes)
Created 2018-03-22 02:14
50 weeks 1 day ago
Ao1 Pointblank
25
points ]
 (3 votes)
Created 2019-02-20 05:31
2 weeks 1 day ago
Ao1 Pointblank
27
points ]
 (3 votes)
Created 2018-12-10 05:31
12 weeks 3 days ago
26
points ]
 (3 votes)
Created 2018-12-04 15:24
13 weeks 2 days ago
16
points ]
 (2 votes)
Created 2018-12-04 15:42
13 weeks 2 days ago
Ao1 Pointblank
35
points ]
 (4 votes)
Created 2018-12-04 15:12
13 weeks 2 days ago
5
points ]
 (1 vote)
Created 2019-02-11 05:26
3 weeks 3 days ago
Fatality
20
points ]
 (2 votes)
Created 2019-02-14 21:25
3 weeks 5 hours ago
Fatality
30
points ]
 (3 votes)
Created 2019-02-12 03:56
3 weeks 2 days ago
Doko
44
points ]
 (5 votes)
Created 2018-11-05 21:53
17 weeks 3 days ago
Ao1 Pointblank
10
points ]
 (1 vote)
Created 2019-01-15 01:58
7 weeks 3 days ago
arCABAL
20
points ]
 (2 votes)
Created 2019-01-14 22:07
7 weeks 3 days ago
56
points ]
 (7 votes)
Created 2018-07-12 17:59
34 weeks 9 hours ago
Fixxxer
85
points ]
 (9 votes)
Created 2018-10-27 15:21
18 weeks 5 days ago
Redon
114
points ]
 (12 votes)
Created 2018-09-25 22:41
23 weeks 2 days ago
Cooper
59
points ]
 (7 votes)
Created 2016-02-12 07:14
3 years 3 weeks ago
7YearBitch
31
points ]
 (4 votes)
Created 2018-10-14 13:17
20 weeks 4 days ago
Who's new
  • impala97
  • Fixxxer
  • Gangler
  • DON
  • sevnnseven