Ban management in BC2

Battlefield: Bad Company 2 and Medal of Honor, which are both based on the Frostbite engine.
Post Reply
User avatar
Posts: 12359
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle

Ban management in BC2

Post by Edge100x » Fri Apr 09, 2010 10:24 am

The !ban command through our admin daemon will attempt to ban a player both through PB and the game itself, using GUID bans for both that prevent that player from coming in later with a different name. The ban is then saved to disk for both (and should be reloaded for both after the server is restarted).

Its full format is: !ban <some unique part of the player name> <optional reason>. An example usage would be !ban thatguy "You cheated".

Unbanning a GUID is a bit unwieldy, so we don't currently have an !unban command. If you need to unban someone, use our rcon tool or a 3rd party tool, and follow these steps:

1. Use the banList.list command through rcon to get a list of all the current BC2 game bans. It will spit out a line telling you how many bans it holds, then 5 entries for every ban (id-type, id, ban-type, time, and reason).
2. Use banList.remove guid <guid from that list> to remove an individual player (substituting "guid from that list" with the text of the GUID you actually want to remove, of course, and not typing < or >).
3. Use to write the new ban list to disk.
4. Use punkBuster.pb_sv_command "pb_sv_banlist" to get a list of the current PB bans. You can also add a search text to the end, to look for a particular name or GUID.
5. Use punkBuster.pb_sv_command "pb_sv_unban <slot #>" to remove the player from the ban list, based on the slot he is assigned to in #4.

For reference, this is the section on banning from the server docs.

Code: Select all

Request:  banList.load 
Response:  OK 
Response:  InvalidArguments 
Response:  InvalidIdType 
Response:  InvalidBanType 
Response:  InvalidTimeStamp  - A time stamp could not be read 
Response:  IncompleteBan  - Incomplete ban entry at end of file 
Response:  AccessError    - Could not read from file 
Effect:  Load list of banned players/IPs/GUIDs from file 
Comment:  5 lines (Id-type, id, ban-type, time and reason) are retrieved for every ban in the list. 
  Entries read before getting InvalidIdType, InvalidBanType, InvalidTimeStamp and IncompleteBan 
  is still loaded. 
Response:  OK 
Response:  InvalidArguments 
Response:  AccessError    - Could not save to file 
Effect:  Save list of banned players/IPs/GUIDs to file 
Comment:  5 lines (Id-type, id, ban-type, time and reason) are stored for every ban in the list. 
  Every line break has windows “\r\n” characters. 
Request:  banList.add <id-type: id-type> <id: string> <timeout: timeout> <reason: string> 
Response:  OK 
Response:  InvalidArguments 
Response:  BanListFull 
Effect:  Add player to ban list for a certain amount of time 
Comments:  Adding a new player/IP/GUID ban will replace any previous ban for that player/IP/GUID 
  timeout can take three forms: 
    perm - permanent [default] 
    round - until end of round     
    seconds <integer> - number of seconds until ban expires 
  Id-type can be any of these 
    name – A soldier name 
    ip – An IP address 
    guid – A player guid 
  Id could be either a soldier name, ip address or guid depending on id-type. 
  Reason is optional and defaults to “Banned by admin”; max length 80 chars. 
  The ban list can contain at most 100 entries. 
Request:   banList.remove <id-type: id-type> <id: string> 
Response:  OK 
Response:  InvalidArguments 
Response:  NotFound  - Id not found in banlist; banlist unchanged 
Effect:  Remove player/ip/guid from banlist 
Request:   banList.clear 
Response:  OK 
Response:  InvalidArguments 
Effect:  Clears ban list 
Request:   banList.list 
Response:  OK <player ban entries> 
Response:  InvalidArguments 
Effect:  Return list of banned players/IPs/GUIDs.  
Comment:  The list starts with a number telling how many bans the list is holding. 
  After that, 5 words (Id-type, id, ban-type, time and reason) are received for every ban in the list.  
And, this is where you can find more information on PB commands: ... r_Commands

Post Reply