[Cs:s] Automatic mapcycle.txt creator
Posted: Mon Dec 28, 2020 2:12 pm
Hi, can some one make a plugin that automatically create mapcycle.txt from maps that server have.
Syntax: Select all
from commands.server import ServerCommand
from os import listdir
from paths import GAME_PATH
MAP_PATH = GAME_PATH+"\maps"
CFG_PATH = GAME_PATH+"\cfg"
@ServerCommand('mapcycle_create')
def _mapcycle_create(command):
mapcycle_file = open(CFG_PATH+"\mapcycle.txt", "w")
for map in listdir(MAP_PATH):
if ".bsp" in map:
map = map.replace(".bsp","")
mapcycle_file.write(map+"\n")
mapcycle_file.close()
Syntax: Select all
MAP_PATH = GAME_PATH / 'maps'
Syntax: Select all
MAPCYCLE_FILE = CFG_PATH / 'mapcycle.txt'
with MAPCYCLE_FILE.open('w') as open_file:
open_file.write()
Syntax: Select all
for bsp_file in MAP_PATH.files('*.bsp'):
mapcycle_file.write(f'{bsp_file.namebase}\n')
Syntax: Select all
from commands.server import ServerCommand
from paths import GAME_PATH
MAP_PATH = GAME_PATH / 'maps'
MAPCYCLE_FILE = GAME_PATH / 'cfg' / 'mapcycle.txt'
@ServerCommand('mapcycle_create')
def _mapcycle_create(command):
with MAPCYCLE_FILE.open('w') as open_file:
for bsp_file in MAP_PATH.files('*.bsp'):
open_file.write(f'{bsp_file.namebase}\n')