View Single Post
Author Message
databomb
Veteran Member
Join Date: Jun 2009
Location: california
Old 08-30-2011 , 12:36   [CS:S/CS:GO] CT Bans
Reply With Quote #1

[CS:S/CS:GO] CT Bans
by: databomb

Description:
Allows admins to restrict access to the CT team from those who violate the server's rules. Designed for specific usage in Jailbreak environments.

v2.0.0 Feature Details:
https://forums.alliedmods.net/showpo...&postcount=330
Features:
- CT Bans are stored in the ClientPrefs database and survive map changes, re-joins, and server crashes.
- The Rage Ban feature allows admins to CT ban rage quitters who break the server's rules and then quickly disconnect.
- You may give a timed CT ban which will work based on in minutes spent alive (so idlers in spectate or those who suicide at the beginning of the round will not be working toward an unban.)
- The timed CT bans are stored in a SQL table for stateful access.
- The plugin logs CT ban to a SQL table in addition to your regular SM logs.
- Re-displays the team selection screen after an improper selection was made.
- SM Menu integration for the rageban and ctban commands.
- Displays helpful message to users who are CT banned when they join the server.
- SM Translations support.
- Custom reasons permitted (addons/sourcemod/configs/ctban_reasons.ini).
- Custom ban lengths permitted (addons/sourcemod/configs/ctban_times.ini)

Installation:
Place the ctban.phrases.txt file in your addons/sourcemod/translations directory.
Place the sm_ctban.smx file in your addons/sourcemod/plugins directory.
Check your logs/server-console after the initial load for any SQL errors. If you have any SQL errors check your addons/sourcemod/configs/databases.cfg file and verify you can connect using the drivers you have specified.
Upgrade: Delete cfg/sourcemod/ctban.cfg or manually add new convars to the file.
Optional: Generate custom reasons list by creating a simple text file (addons/sourcemod/configs/ctban_reasons.ini) with 1 reason per line.
Spoiler

Optional: Generate custom times in (addons/sourcemod/configs/ctban_times.ini)
Spoiler


Command Usage:

sm_ctban <player> <time> <optional: reason>
Bans the selected player from joining the CT team.

sm_removectban <player> | sm_unctban <player>
Removes the CT ban on the selected player.

sm_isbanned <player>
Reports back the status of the current player's CT ban and the time remaining on the ban, if any.

sm_rageban
Brings up a menu so you may choose a recently disconnected player to permanently CT ban.

sm_ctban_offline <steamid>
Bans the given Steam Id from playing on the CT team.

sm_removectban_offline <steamid> | sm_unctban_offline <steamid>
Unbans the given Steam Id from the CT team.

sm_reset_ctban_cookies <'force'>
Resets the entire CTBan cookie database.

sm_forcect <player>
Overrides any CTBans and swaps a player to CT team.

sm_unforcect <player>
Removes overrides and moves player to T team.

sm_isbanned_offline <steamid>
Reports back the status of the target Steam Id from the ban database.

sm_change_ctban_time <player> <time>
Changes an existing CTBan to the new time specified. 0 would be permanently CTBan.

sm_ctbanlist
Displays a menu of active players who are CT Banned.

Settings:
sm_ctban_soundfile, <path>: The path to the soundfile to play when denying a team-change request. Set to "" to disable.
sm_ctban_joinbanmsg, <message>: This message is appended to a time-stamp when a CT banned user joins the server.
sm_ctban_table_prefix, <prefix>: This prefix will be added in front of the table names.
sm_ctban_database_driver, <driver>: This specifies which driver to use from database.cfg
sm_ctban_force_reason, [0,1]: Specifies whether a reason is required for the CT Ban command.
sm_ctban_checkctbans_adminflags, [a-z]: Specifies the admin flag levels that may use the !ctbanlist and !isbanned command targeting anyone. Blank allows all players access on everyone.
sm_ctban_isbanned_selftarget, [0,1]: Specifies whether a non-admin can target themselves using the !isbanned command.
sm_ctban_respawn, [0,1]: Specifies whether to respawn players after team changes.

Special Thanks (Development):
Azelphur for snippets of cross-mod code.
Kigen for the idea of CT banning based on time spent alive.
oaaron99 for the idea of smart !ctban menu re-directs.
Bara for include file ideas.

Future Considerations:
Using API-- Steam Group CTBans

Plugins Using CTBan API:
!tctban Limited Timed CTBan for Lower Admins https://forums.alliedmods.net/showthread.php?p=2547113

Change Log:
2.0.3 Adds !rageban console user support. Fixed bug where !rageban was not permanent. Fixed bug with custom times (configs/ctban_times.ini) not displaying menu options correctly.
Adds multi-targeting filters for other admin commands: @ctban @!ctban and @noctbans (@noctbans specifies players who have never had a CT Ban).
2.0.2 Adds SQLite support. Updated include file: Adds more intelligent #tryinclude and pre-compile directives.
Alerts admins if someone is swapped to CT without !forcect. Added custom times options (configs/ctban_times.ini).
2.0.1 Small bug fixes in UnForceCT, ForceCT, and OnClientAuthorized code segments.
2.0.0 Ported to the new syntax. Translation file updated. CS:GO Fixes bug where mp_force_pick_time could assign a banned player to CT. Made !ctban open menus if more info is needed.
CS:GO Fixes incompatibility with Zephyrus's Team Limit Bypass plugin. Adds spawn check to verify CTBans. Added !forcect/!unforcect to override CTBan and swap players.
Allows custom reasons (configs/ctban_reasons.ini). Allows non-admins to use !isbanned. Added command to reset all CT Ban cookies. Added Player Commands menu for !unctban.
Adds CT Ban to !admin Player Commands menu. Allowed fallback for !isbanned to return ban info even if database log entries were missing. Added !ctbanlist command.
Added CT Ban reason to !ctban chat output where possible. Changed from [SM] to [CTBAN] chat tag and added colors. Removing compile option USESQL (Now Always Uses SQL).
Added !isbanned_offline to find CT Ban info of offline players. !ctban_offline and !unctban_offline now update the log database records.
Added convar sm_ctban_respawn to allow respawns after team swaps due to !ctban or !forcect. Added !change_ctban_time command to edit the time remaining on CTBans.
Added API (ctban.inc) for 3rd-party plugin interfaces. The convar sm_ctban_enable is being removed (disable the plugin to disable functionality).
Upgraded database log table to include an auto incrementing primary key (ban_id) -- automatically upgrades from tables.
Added check for enforcing CTBans if the plugin is loaded late.
1.6.2 Translation file updated. Added admin, time, reason information for !isbanned. Show !rageban results in chat to players. Added ConVar for forcing !ctban reason.
1.6.1.4 Fixed bug preventing console CT bans (thanks Kailo!)
1.6.1.3 Fixed bug with EscapeString function which caused query failures
1.6.1.2 Fixed SQL Injection vulnerability
1.6.1.1 Fixed problem in UTIL_TeamMenu()
1.6.1 Support for new SM1.4 natives, Added config file generation
1.6.0 Added support for new SM1.4 natives
1.5.0 Initial public release
1.4.4 Stable internal build
Attached Files
File Type: inc ctban.inc (15.5 KB, 2167 views)
File Type: sp Get Plugin or Get Source (sm_ctban.sp - 6821 views - 113.3 KB)
File Type: txt ctbans-list.txt (4.5 KB, 2371 views)
File Type: txt ctban.phrases.txt (9.9 KB, 2455 views)
__________________

Last edited by databomb; 04-13-2018 at 12:49. Reason: fixed translation file error for "fr"
databomb is offline