View Single Post
Author Message
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 11-21-2010 , 10:40   [STB2] Save Temporary Bans 2
Reply With Quote #1

[STB2] Save Temporary Bans 2
- Storage temporary bans, in order not lose them after server reboot
*PS
If you already have SourceBans, don't use this !!


If you didn't know,
Source Dedicated Server handle bans from "computer memory" (server command listid)
and these bans disapear when server reboot.
To get bans work after server reboot, you need first execute permanent ban list.
Add
exec banned_user.cfg
exec banned_ip.cfg

in ...cfg/autoexec.cfg file
When there come changes in SRCDS ban list in "memory" (more bans or unban),
need save all current bans from "memory" to banned_user.cfg file
Add
writeid
writeip

in ...cfg/server.cfg file
about forked server


But this not work on temporary bans what have timelimit when expire (day, week, moth ban length).
Then you need install plugin what keep these bans activate.


  • This plugin not save IP and permanent bans.
  • Save only bans by SteamID with timelimit when expire.
  • Maximum ban duration is 525600 minutes (year)
  • Can setup to use SourceMod own SQLite or MySQL.
  • Expired bans will disapear after server reboot or reloading plugin

Immunity
Admins with flag "e" (unban).
Can override to different flag or "allow" one of admin groups use stb2_immunity
Notice! Works only stb2_mode 1 and 2

Cvars
Plugin generate automatically configuration file in ...cfg/sourcemod/plugin.stb2.cfg
Code:
stb2_leave_srcds_ban "0"
// When enabled, it not remove ban from srcds ban list after banning
// min. 0.0 - max. 1.0

stb2_mode "1"
// Handle temporary bans after reboot
//  0 = Add bans normally in server, banid
//  1 = Kick client with ban msg
//  2 = Kick client with ban msg, add 1 minute IP ban
// min. 0.0 - max. 2.0
Admin Commands
Code:
sm_stb2_banlist
//List STB2 bans in console
//Admins flag "d" (ban) can use this
 
sm_stb2_unbanlist
//List STB2 expired bans in console
//Admins flag "d" (ban) can use this
Installation
- Move plugin stb2.smx in ...addons/sourcemod/plugins/
- Move translation stb2.phrases.txt in ...addons/sourcemod/translations/
- Edit with notepad ...addons/sourcemod/configs/databases.cfg
Code:
"Databases"
{
    "driver_default"        "mysql"
    
    "default"
    {
        "driver"            "default"
        "host"                "localhost"
        "database"            "sourcemod"
        "user"                "root"
        "pass"                ""
        //"timeout"            "0"
        //"port"            "0"
    }
    
    "storage-local"
    {
        "driver"            "sqlite"
        "database"            "sourcemod-local"
    }

    "clientprefs"
    {
        "driver"            "sqlite"
        "host"                "localhost"
        "database"            "clientprefs-sqlite"
        "user"                "root"
        "pass"                ""
        //"timeout"            "0"
        //"port"            "0"
    }

    "stb2"
    {
        "driver"            "sqlite"
        "host"                "localhost"
        "database"            "stb2"
    }
}
Bans start save in ...addons/sourcemod/data/sqlite/stb2.sq3



Chat announce
Player Bacardi left the game (Banned)
364d 20h 52m 55s left = 2012-06-01 17:15:33


Screenshots
Kick message to banned player when they try connect to server
in stb2_mode 1 or 2


Show list bans/unbans, print 5 id at time.
Can also search certain id
(Now using commands from rcon)



Using MySQL
- First, you have own MySQL database
- Edit databases.cfg
Code:
    "stb2"
    {
        "driver"            "mysql"
        "host"                "address"
        "database"            "databasename"
        "user"                "user"
        "pass"                "password"
    }
- With this setup you have the opportunity use temporary bans in multiple servers

Usage Admin commands
- Show 5 bans what are recently added.
sm_stb2_banlist

- Show next 5 bans, etc. etc.
sm_stb2_banlist 5

- Show certain ban by steamid
sm_stb2_banlist LIKE STEAM_0:1:12345

- Show 5 bans which contains given text or number, example id from above
sm_stb2_banlist LIKE %345%

- sm_stb2_unbanlist works same way

Credits
SM Developer team
Wiki SQL (SourceMod Scripting)
Save Scores (1.3.4)
SoD Player Stats

log
Code:
Version 2.0, 2.6.2011
- Rewrite whole crap
- Renamed to [STB2] Save Temporary Bans 2

Version 0.5, 1.6.2011
- Fix error when player/admin have ' in name or in reason text

Version 0.4, 27.12.2010
- Quick update to stb_rejectmode 0, other way do executebans.
- Forget add event server_removeban, updated

Version 0.3, 26.12.2010
- Re-write whole crap
- Now should save all temporary bans by steamid with timelimit
- sm_stb_list show now 5 bans at time, see next 5 bans add number, sm_stb_list 5
- Cvar stb_printrejected 0/1, when enabled
print in chat to all banned-player with ban time left when they try connect to server

Version 0.2, 6.12.2010
- Removed cvar 'stb_immunityflags'
- Change check admin immunity, added immunity (so called "command") stb_immunity

Version 0.1, 21.11.2010
- Release
Attached Thumbnails
Click image for larger version

Name:	kick_msg.gif
Views:	15887
Size:	27.3 KB
ID:	86928   Click image for larger version

Name:	console_msg.gif
Views:	16464
Size:	38.2 KB
ID:	86930  
Attached Files
File Type: zip stb2.zip (20.6 KB, 1891 views)
File Type: smx stb2.smx (10.6 KB, 952 views)
File Type: txt stb2.phrases.txt (1.5 KB, 1029 views)
File Type: cfg databases_example.cfg (802 Bytes, 724 views)

Last edited by Bacardi; 06-26-2012 at 02:54. Reason: rewrite whole crab
Bacardi is offline