-
Notifications
You must be signed in to change notification settings - Fork 0
ServerCommando
###Class Purpose:
This class is used as a template for sending, receiving, and processing RCON commands. It is a large class consisting of many properties and functions.
__init__(self, SOCKET)
Description: This function contains a parameter called SOCKET for the server variable to use. There is also two lists: self.usergroup
# Creating a ServerCommando object named 'variable'
# "s" is already declared as a socket
variable = ServerCommando(s)
_balance = variable.autobalance
print(_balance)
# property autobalance gets a bool so _balance is set to a bool
# >> True
print(variable.currentmap())
# >> 1 (the index in the map list)- runnextlevel(self)
Description: This function runs the RCON command
exec admin.runnextlevelto run the next level on the server's maplist.con. It does not return anything.
# Variable set to ServerCommando
variable.runnextlevel()
# >> - runrestartlevel(self)
Description: This function runs the RCON command
exec admin.restartMapto restart the map that is currently running. It does not return anything
# Variable set to ServerCommando
variable.runrestartlevel()
# >>- runkickpl(self, playerid, reason)
Description: This function runs the RCON command
kick '<playerid>' '<reason>'to kick a certain player from the server with a reason. It returns nothing if successful, but returnsError: player Player1 not foundif the specified. (NOTE: The parameterplayeridrefers to bf2cc pl's index or the player's name, BUT using the index is always advised)
# Variable set to ServerCommando
print(variable.runkickpl("Player1", "|ccc| You're pretty bad, kid"))
# >>
# OR
# >> Error: player Player1 not found- runkickplalt(self, playername)
Description: This function runs the RCON command
exec admin.kickplayer '<playername>'to kick a certain player by using the name given. It does not have areasonparameter so you cannot give a reason as to the kick and because it is byplayername, inputting the wrong or unfinished name will result in unexpected results.
# Variable set to ServerCommando
print(variable.runkickplalt("Player1"))
# >>
# OR
# >> Error: player Player1 not found- listplayers(self)
Description: This function runs the RCON command
exec admin.listPlayersto list all the players in the server. The command outputs the Id, the Player's name, CD-key Hash, and the remote IP. Though, take note that all this can be provided by thebf2cc plcommand, and the CD-key Hash is equivalent to profileIDs of players, and remote IP is redirected to EA's Swedish servers due to a privacy policy update.
# Variable to set to ServerCommando
print(variable.listplayers(self))
# > Id: 17 - Player1 is remote ip: 62.247.128.101:1234 ->
# CD-key hash: 1234567890- appendmap(self, mapname, gamemode, numpl)
Description: This function runs the RCON command
exec mapList.append <mapname> <gamemode> <numpl>to append a new map to the end of the server's maplist.con. The mapname needs to be the name given in the game's installation directory; the gamemode is eithergpm_sa(Assault) orgpm_rush(Rush); the numpl is the number of people allowed on that map. This value should always be set to 32 (or maybe even lower?). The function returnsMap <mapname> can't be used on a ranked serverif it errors out.
# Variable to set to ServerCommando
print(variable.appendmap("Dalian", "gpm_rush", 32)
# > 0
# OR
# > Map Dalian can't be used on a ranked server- insertmap(self, index, mapname, gamemode, numpl)
Description: This function runs the RCON command
exec mapList.insert <index> <mapname> <gamemode> <numpl>to insert a new map to a specified index of the server's maplist.con. The index refers to the order in which the maps are listed in the server's maplist.con. The mapname needs to be the name given in the game's installation directory; the gamemode is eithergpm_sa(Assault) orgpm_rush(Rush); the numpl is the number of people allowed on that map. This value should always be set to 32 (or maybe even lower?). The function returns nothing(?)
# Variable to set to ServerCommando
print(variable.insertmap(1, "Dalian", "gpm_rush", 32))
# >- savemapcon(self)
Description: This function runs the RCON command
exec maplist.saveto save the modified maplist.con file in the server. This function returns nothing.
# Variable to set to ServerCommando
print(variable.savemapcon())
# >- reloadmapcon(self)
Description: This function runs the RCON command
exec maplist.reloadto reload the server's maplist.con.
# Variable to set to ServerCommando
print(variable.reloadmapcon())
# >- clearmaplist(self)
Description: This function runs the RCON command
exec maplist.clearto CLEAR the server's maplist.con, and the default map that the server runs instead is... Karkand(?)
# Variable to set to ServerCommando
print(variable.clearmaplist())
# >- removemaplist(self, index)
Description: This function runs the RCON command
exec maplist.remove <index> to remove a certain map that is specified by theindex` parameter. It returns nothing.
# Variable to set to ServerCommando
print(variable.removemaplist(0))
# >- rconusers(self)
Description: This function runs the primitive command of
usersto list all current TCP connections to the server. The function returns information to init's listusergroup.
# Variable to set to ServerCommando
variable.rconusers()
print(variable.usergroup)
print(variable.usergroup[1])
# > ['active rcon users:', 'tcp: 00.000.000.000', 'tcp: 12.123.123.123']
# > 'tcp: 00.000.000.000'- addjoinmsg(self, message)
Description: This function runs the announcer command
announcer addJoin '<message>'to add a Join Message to the announcer module. The function does not return anything.
- addtimemsg(self, message, start, repeat)
Description: This function runs the announcer command
announcer addTimed <start> <repeat> '<message>'to add a Timed Message.
- removejoinmsg(self, joinid)
Description: This function runs the announcer module command
announce removeJoin <joinid>to remove a certain join message from the mm_announcer module. It does not return anything, and to get easy access to a joinid, you can accesslistmsgproperty
# Variable to set to ServerCommando
variable.removemsg(1)
# >- removetimemsg(self, timeid)
Description: This function runs the announcer module command
annonunce removeTimed <timedid>to remove a certain timed message from the mm_announcer module. It does not return anything, and to get easy access to a timeid, you can access thelistmsgproperty
# Variable to set to ServerCommando
variable.removetimemsg(1)
# >###Classes
- TCPBARE
- PlayerStruc
- MapStruc
- ServerCommando
- BF2CC
- ChatStruct
- ChatLog
- Profiling
- Limiter
- GrabSource
###Files