Raised This Month: $ Target: $400
 0% 

[CS:GO/CS:S] Simple Weapon Restrictor


Post New Thread Reply   
 
Thread Tools Display Modes
Author
N1ckles
New Member
Join Date: Apr 2015
Location: Denmark
Plugin ID:
5254
Plugin Version:
1.0.0
Plugin Category:
Gameplay
Plugin Game:
Counter-Strike: GO
Plugin Dependencies:
    Servers with this Plugin:
    7 
    Plugin Description:
    A simple plugin for restricting use of weapons.
    Old 06-20-2016 , 12:21   [CS:GO/CS:S] Simple Weapon Restrictor
    Reply With Quote #1

    Simple Weapon Restrictor
    This plugin simply restricts weapons, so they can't be used. All weapons can easily be restricted by the use of commands or the config file. The plugin is "sv_cheats"-friendly, and it's impossible to equip a restricted weapon. (If that's not the case, please contact me)

    Feature list
    • Very simple to use
    • Prevent specific weapons from being used
    • Control restricted weapons through commands
    • Easy-to-use config file for permanent restrictions

    Commands
    • wr_restrict <weapon*> - Restricts the given weapon.
    • wr_unrestrict <weapon*> - Unrestricts the given weapon.
    • wr_reload - Reloads the config files. (Note: This removes all temporary restrictions.)
    All commands require the config admin flag.
    *: The weapon parameter can either be the classname (e.g. weapon_awp) or the weapon alias (e.g. awp). It's also case-insensitive.

    Config
    The config adds a neat and simple way to permanently restrict weapons. It's not needed and does not have to be present at all. The config is located in addons/sourcemod/configs/restricted_weapons.txt. It's a plain text file, where each line is an entry in the restrictions list. A line consists of just a weapon alias, which works the same way as the commands. The plugin will yield warning, if a line is an invalid weapon or if the same weapon is listed multiple times. An example of a config file could be:
    Code:
    awp
    p90
    weapon_Glock
    rpg
    weapon_deagle
    weapon_stunstick
    P90
    The config can use both class names and weapon aliases. There's some invalid weapons and some other weapons are listed multiple times in this config. The plugin skips the invalid entries and works fine even with errors in the config, but it does print some warnings in the console to assist the server manager:
    Code:
    [WR] Config file: WARNING - Invalid entry: rpg! (Line: 4)
    [WR] Config file: WARNING - Invalid entry: stunstick! (Line: 6)
    [WR] Config file: WARNING - Duplicate entry: p90! (Line: 7)
    [WR] Config file: Loaded 4 restriction(s).
    This makes it easy to identify mistakes. It loaded 4 restrictions in total: awp, p90, glock, and deagle. The other lines were simply skipped. A more detailed description of the loading process can be seen with debug enabled. The ConVar config is located in cfg/sourcemod/restricted_weapons.txt

    Installation
    If you want to utilize the config file, then you have to manually create the file: addons/sourcemod/configs/restricted_weapons.txt. Otherwise, it's a normal plugin installation.

    ConVars
    • wr_debug (default: false/0) - Prints debug information to the console.
    • wr_version - The current version of the plugin.

    Plans
    • Commenting in config file
    • Listing restrictions
    • Further customization
    I see this plugin as done, because I want to keep it simple. But I'm open for suggestions.

    Notes
    This plugin must be compiled with SourceMod v1.8 or higher.
    I know this plugin isn't anything major, but I've been working with SourcePawn for about a year now, and I've mostly done private plugins. I thought this simple plugin, which I made for a friend, might be a good start on AM. So, yea, this is also my first post, so the formatting might be odd. Thanks for giving my plugin a look!
    Attached Files
    File Type: sp Get Plugin or Get Source (SimpleWeaponRestrictor.sp - 2082 views - 9.1 KB)
    File Type: smx SimpleWeaponRestrictor.smx (17.7 KB, 2576 views)

    Last edited by N1ckles; 04-24-2020 at 10:08.
    N1ckles is offline
    343N
    Member
    Join Date: Jul 2015
    Old 08-14-2016 , 05:13   Re: [CS:GO/CS:S] Simple Weapon Restrictor
    Reply With Quote #2

    Thanks heaps for this!
    343N is offline
    usla
    Senior Member
    Join Date: Jul 2009
    Old 10-08-2016 , 14:48   Re: [CS:GO/CS:S] Simple Weapon Restrictor
    Reply With Quote #3

    works on armor/kevlar also ?
    edit:
    yes and no
    it will restrict from being bought from menu but anyone can buy it using "buy vest" or "buy vesthelm"

    Last edited by usla; 12-09-2016 at 06:53. Reason: DOES NOT
    usla is offline
    Blue Malgeran
    Junior Member
    Join Date: Apr 2017
    Location: Israel
    Old 03-02-2018 , 13:19   Re: [CS:GO/CS:S] Simple Weapon Restrictor
    Reply With Quote #4

    Nice! Thanks for share ♥
    __________________
    Blue Malgeran is offline
    Br0k3n1337
    New Member
    Join Date: Mar 2018
    Old 03-09-2018 , 23:25   Re: [CS:GO/CS:S] Simple Weapon Restrictor
    Reply With Quote #5

    Quote:
    Originally Posted by N1ckles View Post
    Simple Weapon Restrictor
    This plugin simply restricts weapons, so they can't be used. All weapons can easily be restricted by the use of commands or the config file. The plugin is "sv_cheats"-friendly, and it's impossible to equip a restricted weapon. (If that's not the case, please contact me)

    Feature list
    • Very simple to use
    • Prevent specific weapons from being used
    • Control restricted weapons through commands
    • Easy-to-use config file for permanent restrictions

    Commands
    • wr_restrict <weapon*> - Restricts the given weapon.
    • wr_unrestrict <weapon*> - Unrestricts the given weapon.
    • wr_reload - Reloads the config files. (Note: This removes all temporary restrictions.)
    All commands require the config admin flag.
    *: The weapon parameter can either be the classname (e.g. weapon_awp) or the weapon alias (e.g. awp). It's also case-insensitive.

    Config
    The config adds a neat and simple way to permanently restrict weapons. It's not needed and does not have to be present at all. The config is located in addons/sourcemod/configs/restricted_weapons.txt. It's a plain text file, where each line is an entry in the restrictions list. A line consists of just a weapon alias, which works the same way as the commands. The plugin will yield warning, if a line is an invalid weapon or if the same weapon is listed multiple times. An example of a config file could be:
    Code:
    awp
    p90
    weapon_Glock
    rpg
    weapon_deagle
    weapon_stunstick
    P90
    The config can use both class names and weapon aliases. There's some invalid weapons and some other weapons are listed multiple times in this config. The plugin skips the invalid entries and works fine even with errors in the config, but it does print some warnings in the console to assist the server manager:
    Code:
    [WR] Config file: WARNING - Invalid entry: rpg! (Line: 4)
    [WR] Config file: WARNING - Invalid entry: stunstick! (Line: 6)
    [WR] Config file: WARNING - Duplicate entry: p90! (Line: 7)
    [WR] Config file: Loaded 4 restriction(s).
    This makes it easy to identify mistakes. It loaded 4 restrictions in total: awp, p90, glock, and deagle. The other lines were simply skipped. A more detailed description of the loading process can be seen with debug enabled. The ConVar config is located in cfg/sourcemod/restricted_weapons.txt

    Installation
    If you want to utilize the config file, then you have to manually create the file: addons/sourcemod/configs/restricted_weapons.txt. Otherwise, it's a normal plugin installation.

    ConVars
    • wr_debug (default: false/0) - Prints debug information to the console.
    • wr_version - The current version of the plugin.

    Plans
    • Commenting in config file
    • Listing restrictions
    • Further customization
    I see this plugin as done, because I want to keep it simple. But I'm open for suggestions.

    Notes
    This plugin must be compiled with SourceMod v1.8 or higher.
    I know this plugin isn't anything major, but I've been working with SourcePawn for about a year now, and I've mostly done private plugins. I thought this simple plugin, which I made for a friend, might be a good start on AM. So, yea, this is also my first post, so the formatting might be odd. Thanks for giving my plugin a look!

    How do you restrict a specific class and how do you restrict the weapon to only 1 per team?
    Br0k3n1337 is offline
    AG.1436
    Junior Member
    Join Date: Feb 2019
    Location: in front of this screen
    Old 02-28-2019 , 14:13   Re: [CS:GO/CS:S] Simple Weapon Restrictor
    Reply With Quote #6


    Thanks a lot

    Saved a lot of time for me
    AG.1436 is offline
    Godzilla
    Junior Member
    Join Date: Oct 2017
    Old 03-12-2019 , 21:52   Re: [CS:GO/CS:S] Simple Weapon Restrictor
    Reply With Quote #7

    i can't ban scar-20
    Godzilla is offline
    DrAluminium
    New Member
    Join Date: May 2019
    Old 05-02-2019 , 09:30   Re: [CS:GO/CS:S] Simple Weapon Restrictor
    Reply With Quote #8

    Quote:
    Originally Posted by Godzilla View Post
    i can't ban scar-20
    Just use the class name weapon_scar20 in your restricted_weapons.txt
    DrAluminium is offline
    headhunterzcph
    Member
    Join Date: Nov 2012
    Location: Danmark
    Old 09-06-2019 , 11:02   Re: [CS:GO/CS:S] Simple Weapon Restrictor
    Reply With Quote #9

    How do you restrict a specific class and how do you restrict the weapon to only 1 per team?
    headhunterzcph is offline
    FuHua
    Member
    Join Date: Nov 2019
    Location: 天穹市
    Old 02-13-2020 , 05:58   Re: [CS:GO/CS:S] Simple Weapon Restrictor
    Reply With Quote #10

    C:\csgoserver\csgo\addons\sourcemod\scripting \SimpleWeaponRestrictor.sp(5) : fatal error 183: cannot read from file: "multicolors"
    FuHua 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 02:41.


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