local BotsOn = false local playercount = 0 local function chatMsg(p, t, r, m) if BotsOn == false then return end if m == "!botsoff" then COM_BufInsertText(server, "bots 0") BotsOn = false end if m == "!botseasy" then COM_BufInsertText(server, "bots 9") end if m == "!botshard" then COM_BufInsertText(server, "bots 13") end end local function mLoad(num) if BotsOn == true then print("Type '!botsoff' in chat to remove bots from the server until all players are disconnected") end end local function getPlayers() if BotsOn == false then playercount = 0 for player in players.iterate do playercount = $+1 end playercount = $-1 if not playercount then COM_BufInsertText(server, "bots 9") BotsOn = true end end end addHook("MapLoad", mLoad) addHook("ThinkFrame", getPlayers) addHook("PlayerMsg", chatMsg) addHook("NetVars", function(n) BotsOn = n($) playercount = n($) end)