#JezMap BETA #Written by Jeza #Special thanks to Solii # **Configuration** targetmap = "de_dust2" #Change the above to the default map you would like (e.g. surf_greatriver_fix). counttime = 30 #Change the above to the amount of time (in seconds) required for the server to be empty before map change. waittime = 60 #Change the above to the amount of time (in seconds) before checking player numbers after a map change (may be low due to client map downloads). import es import gamethread def load(): es.msg("JezMap (BETA) addon loaded") es.set("jm_active","1") es.set("count","0") es.doblock("jezmap/check") def unload(): es.set("jm_active","0") es.msg("JezMap addon unloaded") def player_disconnect(event_var): es.doblock("jezmap/check") def es_map_start(event_var): es.msg("JezMap: Waiting " + str(waittime) + " seconds for players to load map.") gamethread.delayed(waittime, check) def player_team(event_var): es.doblock("jezmap/check") def check(): players = es.getplayercount(2) + es.getplayercount(3) count = es.server_var['count'] if int(players) == 0 and es.server_var['eventscripts_currentmap'] != targetmap and int(count) == 0: es.set("count",counttime) es.doblock("jezmap/domap") def domap(): active = es.server_var['jm_active'] players = es.getplayercount(2) + es.getplayercount(3) count = es.server_var['count'] if count > 0 and int(active) == 1: if int(players) > 0: es.msg("JezMap: Player connected. Map change cancelled!") es.set("count", "0") else: if count < 10: es.msg("JezMap: No players found. Changing map to " + str(targetmap) + " in " + str(count) + " seconds.") else: if int(str(count)[1]) == 0 or int(str(count)[1]) == 5: es.msg("JezMap: No players found. Changing map to " + str(targetmap) + " in " + str(count) + " seconds.") count -= 1 es.set("count",count) gamethread.delayed(1, domap) elif int(players) == 0 and int(active) == 1: es.server.cmd("changelevel " + str(targetmap))