Raised This Month: $12 Target: $400
 3% 

[ANY] City Bans


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Dr. McKay
Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
Join Date: Aug 2011
Location: Atlantis
Plugin ID:
3690
Plugin Version:
1.1.0
Plugin Category:
Admin Commands
Plugin Game:
Any
Plugin Dependencies:
    Servers with this Plugin:
    1 
    Plugin Description:
    Allows admins to ban users by their city
    Old 06-11-2013 , 19:35   [ANY] City Bans
    Reply With Quote #1

    [ANY] City Bans

    v1.1.0

    Description:
    Allows admins to ban users by their city.

    Commands:
    • sm_bancity <target> - bans a client by their city (default flag ban)
    • sm_listbannedcities - prints a list of banned cities (default flag unban)
    • sm_unbancity <id> - unbans a city (use sm_listbannedcities to get the ID) (default flag unban)

    Cvars:
    • city_bans_version - plugin version
    • city_bans_f2p - only block Free2Play players in banned cities from connecting (only works in TF2, requires SteamTools), defaults to 1
    • city_bans_message - message to display to banned players, defaults to "You have been banned"

    Overrides:
    Admins with access to the "BypassCityBan" override (defaults to root) won't be blocked when they join from banned cities.

    Database:
    City Bans requires a database to store bans in. It will first look for a "citybans" configuration in databases.cfg, then for a "default" configuration. Here's a citybans configuration that uses a local SQLite database (no database server required):

    Code:
        "citybans"
        {
            "driver"            "sqlite"
            "database"            "citybans"
        }
    You can also configure it to use a MySQL database to sync bans across servers.

    Requirements:
    Requires the GeoIPCity extension, and optionally SteamTools for TF2 F2P blocking.

    Installation:
    Install GeoIPCity if you don't have it already (and optionally SteamTools), put citybans.smx into /addons/sourcemod/plugins, and reboot your server or type "sm plugins load citybans" into your console or rcon.

    Auto Update:
    Install Updater. The plugin will be auto-updated according to your Updater settings. It'll work without Updater.

    Changelog:
    • v1.1.0 (7/16/13)
      • Removed quotes requirement in sm_bancity
      • Fixed a couple of issues
    • v1.0.0 (6/11/13)
      • Initial release

    Download Plugin (citybans.smx)
    View Source (citybans.sp)


    Requires updater.inc, mckayupdater.sp, geoipcity.inc, and steamtools.inc to compile.
    __________________

    Last edited by Dr. McKay; 07-14-2020 at 04:38.
    Dr. McKay is offline
    nightrider
    SourceMod Donor
    Join Date: Dec 2008
    Old 06-11-2013 , 20:59   Re: [ANY] City Bans
    Reply With Quote #2

    Very interesting
    Many thanks Dr. McKay
    __________________
    [SIGPIC][/SIGPIC] the pantless
    I am the Night Rider!, I'm a fuel-injected suicide machine.
    I am a rocker! I am a roller!, I am an out-of-controller!


    nightrider is offline
    Doc-Holiday
    AlliedModders Donor
    Join Date: Jul 2007
    Old 06-11-2013 , 21:58   Re: [ANY] City Bans
    Reply With Quote #3

    Kinda awesome actually. Though my. Geo ip shows the city 5 towns over
    Doc-Holiday is offline
    Dr. McKay
    Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
    Join Date: Aug 2011
    Location: Atlantis
    Old 06-11-2013 , 22:41   Re: [ANY] City Bans
    Reply With Quote #4

    Quote:
    Originally Posted by Doc-Holiday View Post
    Kinda awesome actually. Though my. Geo ip shows the city 5 towns over
    Eh, it'll still get the job done.
    __________________
    Dr. McKay is offline
    Doc-Holiday
    AlliedModders Donor
    Join Date: Jul 2007
    Old 06-12-2013 , 02:38   Re: Re: [ANY] City Bans
    Reply With Quote #5

    Quote:
    Originally Posted by Dr. McKay View Post
    Eh, it'll still get the job done.
    Any way to add a feature to ban the city without a client present. ...

    Although not sure where they get the city ids from

    Last edited by Doc-Holiday; 06-12-2013 at 02:40.
    Doc-Holiday is offline
    nightrider
    SourceMod Donor
    Join Date: Dec 2008
    Old 06-12-2013 , 07:59   Re: [ANY] City Bans
    Reply With Quote #6

    CS:S
    <Failed> "[ANY] City Bans" (1.0.0) by Dr. McKay

    an error in logs as smx will not load

    L 06/12/2013 - 07:52:55: [SM] Unable to load plugin "citybans.smx": Native "Steam_GetNumClientSubscriptions" was not found
    __________________
    [SIGPIC][/SIGPIC] the pantless
    I am the Night Rider!, I'm a fuel-injected suicide machine.
    I am a rocker! I am a roller!, I am an out-of-controller!



    Last edited by nightrider; 06-12-2013 at 08:52.
    nightrider is offline
    Dr. McKay
    Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
    Join Date: Aug 2011
    Location: Atlantis
    Old 06-12-2013 , 08:54   Re: [ANY] City Bans
    Reply With Quote #7

    Quote:
    Originally Posted by nightrider View Post
    CS:S
    <Failed> "[ANY] City Bans" (1.0.0) by Dr. McKay

    an error in logs as smx will not load

    L 06/12/2013 - 07:52:55: [SM] Unable to load plugin "citybans.smx": Native "Steam_GetNumClientSubscriptions" was not found
    Strange... SteamTools should be marked as optional, but I guess asherkin's inc file isn't properly set up.

    I've committed v1.0.1, which should fix this.
    __________________

    Last edited by Dr. McKay; 06-12-2013 at 09:38.
    Dr. McKay is offline
    nightrider
    SourceMod Donor
    Join Date: Dec 2008
    Old 06-12-2013 , 11:06   Re: [ANY] City Bans
    Reply With Quote #8

    Thank you Dr. McKay .
    I will test when I return home from work...

    Update:
    Running fine now.
    "[ANY] City Bans" (1.0.1) by Dr. McKay
    __________________
    [SIGPIC][/SIGPIC] the pantless
    I am the Night Rider!, I'm a fuel-injected suicide machine.
    I am a rocker! I am a roller!, I am an out-of-controller!



    Last edited by nightrider; 06-12-2013 at 20:31.
    nightrider is offline
    scorpadorp
    SourceMod Donor
    Join Date: May 2012
    Location: NC
    Old 07-14-2013 , 11:39   Re: [ANY] City Bans
    Reply With Quote #9

    Wow this is perfect. Thank you.
    scorpadorp is offline
    KyleS
    SourceMod Plugin Approver
    Join Date: Jul 2009
    Location: Segmentation Fault.
    Old 07-16-2013 , 10:53   Re: [ANY] City Bans
    Reply With Quote #10

    argc should be < 1 instead of != 1 as people tend to use spaces with targets. You store and set the CmdReplySource, but you never set the value back to what it was after you print your message. You should consider using GetClientSerial instead of GetClientUserID to prevent potential duplicate checks on the same client. You should also consider checking the returns from a few GetClient* Functions (GetClientIP).

    None of this seems lethal, though.
    KyleS is offline
    Reply


    Thread Tools
    Display Modes

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off

    Forum Jump


    All times are GMT -4. The time now is 07:51.


    Powered by vBulletin®
    Copyright ©2000 - 2024, vBulletin Solutions, Inc.
    Theme made by Freecode