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
10
points ]
 (1 vote)
Created 2019-05-17 21:51
4 days 23 hours ago
Kretrens
35
points ]
 (4 votes)
Created 2019-05-08 05:38
2 weeks 16 hours ago
Sauce
45
points ]
 (5 votes)
Created 2018-08-22 19:15
39 weeks 2 hours ago
65
points ]
 (8 votes)
Created 2018-07-12 17:59
44 weeks 6 days ago
7YearBitch
47
points ]
 (6 votes)
Created 2019-03-07 23:20
10 weeks 5 days ago
Ao1 Pointblank
57
points ]
 (6 votes)
Created 2019-04-28 17:57
3 weeks 3 days ago
17
points ]
 (2 votes)
Created 2018-12-04 15:42
24 weeks 1 day ago
Created 2019-04-24 04:01
4 weeks 17 hours ago
80
points ]
 (8 votes)
Created 2010-07-14 21:46
8 years 44 weeks ago
Fatality
60
points ]
 (7 votes)
Created 2019-04-01 02:30
7 weeks 2 days ago
Ao1 Pointblank
Created 2019-03-04 15:01
11 weeks 2 days ago
84
points ]
 (9 votes)
Created 2010-07-21 06:51
8 years 43 weeks ago
Ao1 Pointblank
81
points ]
 (9 votes)
Created 2018-03-22 02:14
1 year 8 weeks ago
Ao1 Pointblank
25
points ]
 (3 votes)
Created 2019-02-20 05:31
13 weeks 16 hours ago
Ao1 Pointblank
36
points ]
 (4 votes)
Created 2018-12-10 05:31
23 weeks 2 days ago
26
points ]
 (3 votes)
Created 2018-12-04 15:24
24 weeks 1 day ago
Ao1 Pointblank
35
points ]
 (4 votes)
Created 2018-12-04 15:12
24 weeks 1 day ago
5
points ]
 (1 vote)
Created 2019-02-11 05:26
14 weeks 2 days ago
Fatality
20
points ]
 (2 votes)
Created 2019-02-14 21:25
13 weeks 6 days ago
Fatality
30
points ]
 (3 votes)
Created 2019-02-12 03:56
14 weeks 1 day ago
Who's new
  • impala97
  • Fixxxer
  • Gangler
  • DON
  • sevnnseven