AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Unapproved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=109)
-   -   Weapon Restrictions (https://forums.alliedmods.net/showthread.php?t=69987)

Liam 04-15-2008 10:09

Weapon Restrictions
 
1 Attachment(s)
This plugin was designed and tested for use on Counter-Strike: Source. It uses some of the SDK Calls that teame06 wrote for GunGame: Source, and would not have been possible without the help of teame06, BAILOPAN, pRed, Tsunami, and many others who idle #sourcemod.

If you have any questions or find any issues, please let me know either here or in #sourcemod on irc.gamesurge.net.

Instructions for installation:

Download and unzip the attached file. The zip file has been designed to mimic the structure of a standard srcds installation, and all files are in their correct places.

I've expanded this out to use a translations file, a gamedata file, and two config files, so make sure you check the file contents before just dropping it in, or you will have trouble.

This requires the latest version of the 1.0.3 Sourcemod snapshot.

Usage:
sm_restrict <weapon|group> <amount|default=0> <all=default|ct|t>
sm_unrestrict <weapon|group> <all=default|ct|t>
sm_addgroup <"group name"> <"weapon_one weapon_two weapon_three">
sm_grouplist
sm_dropc4

Notes:
-If you want to setup "static" groups, you will need to add the command to either server.cfg or restrict_weapons.cfg in the above format.
-Ex. sm_addgroup "pistols" "glock p228 deagle"

Valid weapons are:
Code:


"glock", "usp", "p228", "deagle",
"elite", "fiveseven", "m3", "xm1014",
"galil", "ak47", "scout", "sg552",
"awp", "g3sg1", "famas", "m4a1",
"aug", "sg550", "mac10", "tmp",
"mp5navy", "ump45", "p90", "m249",
"flashbang", "hegrenade", "smokegrenade", "c4"

Changelog:
Code:

1.0
--Totally rewrote the array setup for the restrictions.
--Allowed the weapon restrictions to differ by team.
--Added knives, pistols, and single-weapon round commands.
--Modified unrestrict to allow all unrestrictions.
--Added in restrict_weapons.cfg for the cfg\sourcemod for weapon\cvar management.
--Rewrote all of the checks to be more efficient and faster.
--Fixed a small problem in the g_ShortWeaponNames[] array.
--Fixed a small problem in the g_WeaponNames[] array.
--Added an additional check into the Command_Restrict function to send a message to the client/console and to also add a log to the error log with what was wrong.
2.0
--Rewrote plugin from scratch to greatly improve efficiency and speed.
--Added a public tracking cvar.
--Repaired all bugs with weapons not being properly restricted.
--Removed teame06's hack system.
--Added checks to grab on round start, weapon_pickup, and weapon_fire.
--Weapons refund money only on weapon_fire and if they are carrying it when restricted.
--Fixed the version number in the plugin.
2.1
--Added a warmup system
--Exported warmup configs out to addmons\sourcemod\configs
--Exported restriction configs out to cfg\sourcemod
--Added a warmup cvar (g_Cvar_Warmup) so the warmup system is trackable for external plugins
--Added sm_dropc4 for use on de_* maps
--Added DropC4 to the Server Commands menu
--Added Restrict Weapons to the Server Commands menu
2.2
--Added cvars to handle all global weaon configs
--Added cvars to handle warmup system
--Exported all cvars to a single cfg file located in cfg/sourcemod
--Added functions to watch the cvars and make changes as necessary
2.2
--Fixed a bug in the cVar / cfg system
2.3
--Fixed the issue with the cVars not restricting weapons properly on initial load.
--Added sm_unrestrict all option. (sm_restrict <all|weapon> <all|team>)
2.4
--Corrected the missing bracket in the code.
--Added the polish translations. Thanks Zuko!
2.5
--Added in additional cVars for weapon management.
2.6
--Corrected the typo in the warmup cvar that had you set it to 2 to disable it. Should have been 0. Warmup disables without any issue.
--Fixed the issue with weapons not restricting from the cfg file correctly.
2.7
--Corrected issues with it not granting a valid weapon when one was restricted. (If you restrict them all, yes, they will walk around without a weapon.)
--Corrected the bug in the warmup system.
--Added a define in the code to remove the menu system from the compiled file. #define STOCK_MENUS 1, set to 0 to remove all menu functionality.
--Added in checking for 'shorthand bind commands'.
2.8
--Fixed a bug in the he/smoke/flashbang restrictions.
2.9
--Fixed issues with restrictions not working correctly.
--Corrected a bug where warmup wouldn't disable on first run of the plugin.
--Fixed issues with it not removing restricted weapons from the world either on start or on drop.
2.9b
--Fixed issues with restrictions set in the cfg not parsing over map changes. (Thanks to Derek for pointing this out.)
--Cleaned up the ConVar code a bit to make restrict.sp more organized.
3.0
--Added group restrictions for weapons
--Added sm_addgroup command
--Added sm_grouplist command
--Corrected a bug where it was stripping guns from teams who were not being restricted.
--Cleaned up the weapon swap code to be faster and more efficient.
--Cleaned up the core code to be more readable and organized
3.0.1
--Corrected the bug in the warmup system where it wasn't stripping the starting weapons.
--Rewrote the group restrict system to set the entire groups limit to a
number. Ie. Group: "Test" contains "m4a1 ak47 p90" and is restricted to
1. Only one m4a1, ak47, or p90 may be used. Any attempt to buy or
pickup another weapon in that group will result in failure.
3.0.2
--Corrected a bug in the weapon group buy code.
--Changed the warmup config file format. Please replace or update yours correctly.
--Changed the translation file format. Please replace yours with the one included.
--Fixed a typo in the translation file format.

TODO:
Version 3.1 will include the following:
--sm_knife and sm_pistols
--team based restrictions in menu

As always, when uploading this plugin, please -restart- your counter-strike server so that all old bad cvar values are nixed.

Please let me know if you experience any issues.


Enjoy!

tcviper 04-15-2008 10:35

Re: Weapon Restrictions
 
This works like a charm, very good work finally a simple decent weapon restrictions plugin!

Liam 04-15-2008 11:15

Re: Weapon Restrictions
 
Updated to setup directory structure to match Sourcemod's. Also fixed an exploit that sfPlayer caught.

Thanks!

[Arnold] 04-15-2008 11:52

Re: Weapon Restrictions
 
Great, thanks for your work! Two questions: is it possible to query the present restrictions? Are the restrictions saved, or do I need to exec the sm_restrict lines via a config file?

Liam 04-15-2008 12:02

Re: Weapon Restrictions
 
Weapon restrictions are cleared at the end of each map. So if you want a weapon restricted every map you'll need it in server.cfg for now.

ie.
sm_restrict awp
or
sm_restrict awp 2
or
sm_restrict awp 2 <team>

One of my 'todos' is to add in a weapons.cfg file that will execute each map change, and that will be added in sometime in the near future.

Now, insofar as current restrictions. No, there isn't any way to do that. I will make a note though and implement that at the same time I do the weapons.cfg.

[Arnold] 04-15-2008 12:12

Re: Weapon Restrictions
 
Great! One last question: is there a way to lift all restrictions at a time or is sm_unrestrict limited to a specific weapon? If not, something like sm_unrestrict_all would come in handy.

Liam 04-15-2008 12:32

Re: Weapon Restrictions
 
I'll add it to my todo list. :)

Alternately, just change the map.

Snapcase452 04-15-2008 12:53

Re: Weapon Restrictions
 
Is there anyway to allow the admins to use the restricted weapons?

Liam 04-15-2008 13:06

Re: Weapon Restrictions
 
Restricted is restricted. Its easily added in though.

[Arnold] 04-15-2008 15:05

Re: Weapon Restrictions
 
I get lots of these error messages from the plugin:

Quote:

L 04/15/2008 - 21:03:12: [SM] Native "SDKCall" reported: Entity 98 is not valid or is freed
L 04/15/2008 - 21:03:12: [SM] Debug mode is not enabled for "restrict.smx"
L 04/15/2008 - 21:03:12: [SM] To enable debug mode, edit plugin_settings.cfg, or type: sm plugins debug 2 on

Liam 04-15-2008 15:47

Re: Weapon Restrictions
 
Added an additional check in to hopefully stop that.

Davethegreat 04-15-2008 19:07

Re: Weapon Restrictions
 
What about limiting it to one weapon.

Liam 04-15-2008 19:21

Re: Weapon Restrictions
 
Quote:

Originally Posted by Davethegreat (Post 612106)
What about limiting it to one weapon.

Can you explain?

Twelve-60 04-15-2008 22:45

Re: Weapon Restrictions
 
I think he means instead of restricting 1 by 1, restricting all but 1.

- Twelve-60

SirCole 04-15-2008 23:17

Re: Weapon Restrictions
 
I love the plugin, works well, ever so simple.

call me whatever, but a suggestion would be to create a simple menu to go with it, but it would be pointless to create one if you don't integrate it into the sm_admin menu..

by doing that you should be able to satisfy a fair few people.

Cole

Gweedo 04-16-2008 01:07

Re: Weapon Restrictions
 
Maybe use the new dynamic menu to create your own?

I was just getting so fed up with Bugs plugin I was about to write my own. Good work.

GriMz 04-16-2008 02:29

Re: Weapon Restrictions
 
is there a chance that maybe you could add in KDR support?

lets say with 15 players, you want awps restricted to 2 per team, but to use a awp you must have under a 1.4 KDR, or a .80 kdr for auto snipers, anything above like 1.4 = scout only.

think you could add that functionability to that?

[Arnold] 04-16-2008 03:41

Re: Weapon Restrictions
 
Right now the plugin doesn't prevent players from buying restricted weapons more often than the max. allowed number and than throwing them away for a teammate. I haven't tested if the plugin prevents those players from taking these "supernumerous" weapons, but it shouldn't be possible to outsmart the restrictions that way.

Liam 04-16-2008 07:36

Re: Weapon Restrictions
 
Quote:

Originally Posted by [Arnold] (Post 612238)
Right now the plugin doesn't prevent players from buying restricted weapons more often than the max. allowed number and than throwing them away for a teammate. I haven't tested if the plugin prevents those players from taking these "supernumerous" weapons, but it shouldn't be possible to outsmart the restrictions that way.

Absolutely right. I will get that bug knocked out when I fix a few other things.

As for the menu, this will be integrated into the menu system, I just need to read up on how.

Liam 04-17-2008 18:19

Re: Weapon Restrictions
 
Just to update you all. I'm working on implementing some of these features and fixing some other problems that I got told about on IRC. The plugin itself is fine but I'm just expanding on its functionality, so check back for updates. :)

xJonny 04-19-2008 16:07

Re: Weapon Restrictions
 
Thanks! It's awesome.

I'm going to test it now. I would like to see it added into the sm_admin interface and admin immunity, that would be awesome!

Liam 04-21-2008 20:38

Re: Weapon Restrictions
 
Plugin has been updated and reposted. Changelog is in the initial post along with the new commands.

[Arnold] 04-22-2008 01:43

Re: Weapon Restrictions
 
Great new features, thx Liam.

Xp3r7 04-30-2008 09:06

Re: Weapon Restrictions
 
Somethings I would like to see are the sm_allow, sm_knives and sm_pistols to last till the map changes, not just 1 round. Also, sm_shotguns (all primary weapons restricted but shotguns), sm_snipers (every primary restricted but the scout, awp and autos), sm_nosnipers (no scout, awp, or autos) and sm_subs (all primary restricted but the sub-machine guns like MP5, TMP, P90, etc) and for all of those to last till map change as well.

Just some suggestions. :)

red! 04-30-2008 09:41

Re: Weapon Restrictions
 
cool work. thanks mate.

I have a small additional feature request. something like sm_restrict_status to print out the current restriction state for admins. most likely you will already have something like this for debugging, right?

red! 04-30-2008 18:24

Re: Weapon Restrictions
 
I really like the ease of use, but:

Quote:

L 04/30/2008 - 23:23:06: [SM] Plugin encountered error 15: Array index is out of bounds
L 04/30/2008 - 23:23:06: [SM] Displaying call stack trace for plugin "restrict.smx":
L 04/30/2008 - 23:23:06: [SM] [0] Line 253, restrict.sp::Command_Restrict()
that make the plugin a bit unreliable.

Gently 04-30-2008 23:34

Re: Weapon Restrictions
 
i request a feature for limiting to 0 awps until player amount is > 8.

DJ Tsunami 05-01-2008 12:06

Re: Weapon Restrictions
 
Gently: you can use Execute Configs for that. Just make a config for when there are 8 clients on with the command to restrict the awp to 0, and a config for 9 clients to remove the restriction.

Liam 05-03-2008 12:16

Re: Weapon Restrictions
 
Quote:

Originally Posted by red! (Post 619335)
I really like the ease of use, but:



that make the plugin a bit unreliable.

Make sure you re-download the package. I fixed a bug in one of the arrays about four hours after i posted it originally. I had that issue too and its since been fixed.

red! 05-04-2008 09:02

Re: Weapon Restrictions
 
Ehhm, yes. I read about the fix. But I downloaded it some days after you posted the fix.

It does not happen every time, but still very often. Maybe this behaves different for me, because I trigger the restrictions by another plugin (http://forums.alliedmods.net/showthr...hlight=winning) which may toggle rerstriction status more often than usual.

PStar 05-04-2008 09:20

Re: Weapon Restrictions
 
Can i use it whit map prefix?
So if i want to have different restricitons i ndiferent kind of maps, or the restrict commands can only be in the added cfg file?

red! 05-04-2008 09:24

Re: Weapon Restrictions
 
okay, I managed to avoid the bug to occur.

First I restricted the sniper rifles with "sm_restrict <...> 1 all" for both teams and toggled restrictions for the teams by "sm_restrict <...> 0/1 t/ct". When I substituted the initial config line by a separated commands for each individual team, the bug seams not to occur any more.

Liam 05-04-2008 13:14

Re: Weapon Restrictions
 
Quote:

Originally Posted by PStar (Post 621197)
Can i use it whit map prefix?
So if i want to have different restricitons i ndiferent kind of maps, or the restrict commands can only be in the added cfg file?

You can download my map configs plugin and put restrictions in there if you want. :)

Liam 05-04-2008 13:14

Re: Weapon Restrictions
 
Quote:

Originally Posted by red! (Post 621199)
okay, I managed to avoid the bug to occur.

First I restricted the sniper rifles with "sm_restrict <...> 1 all" for both teams and toggled restrictions for the teams by "sm_restrict <...> 0/1 t/ct". When I substituted the initial config line by a separated commands for each individual team, the bug seams not to occur any more.

I'll take another look at it. I've not had any errors in my logs and I use this on my server all the time.

PStar 05-04-2008 18:09

Re: Weapon Restrictions
 
Quote:

Originally Posted by Liam (Post 621327)
You can download my map configs plugin and put restrictions in there if you want. :)

So i only need to add the restriction command to a execed cfg?

Liam 05-04-2008 20:48

Re: Weapon Restrictions
 
Yes, or if you want to do it per map, then get my map configs plugin and use that.

PStar 05-05-2008 06:40

Re: Weapon Restrictions
 
Quote:

Originally Posted by Liam (Post 621559)
Yes, or if you want to do it per map, then get my map configs plugin and use that.

Will consider it, i already have a permap config plugin, but it think it would be more stabel if there is more releases from one author.

OFF:
PLease make the extension files for the HPK plugin, for Linux.

PStar 05-05-2008 13:08

Re: Weapon Restrictions
 
Getting this error:


L 05/05/2008 - 19:04:18: [SM] Plugin encountered error 15: Array index is out of bounds
L 05/05/2008 - 19:04:18: [SM] Displaying call stack trace for plugin "restrict.smx":
L 05/05/2008 - 19:04:18: [SM] [0] Line 289, restrict.sp::Command_Unrestrict()
L 05/05/2008 - 19:04:18: [SM] [1] Line 288, restrict.sp::Command_Unrestrict()
L 05/05/2008 - 19:04:18: [restrict.smx] sm_restrict - Restricted the awp for the Counter-Terrorist team.
All weapons have been unrestricted.

Using Sm 1.1.0.2125.
restrict.sp was recompilled sucessfuly with no erroers or warnings.

Cannon buy weapons from the buy menu, only the bindings are working (like b+a "buy automatice")

Would like to use your plugin but it don't work.

red! 05-05-2008 15:12

Re: Weapon Restrictions
 
There seem ro be some more bugs

Log says:

Quote:

L 05/05/2008 - 20:41:07: [restrict.smx] sm_restrict - Restricted the awp to 1 for the Counter-Terrorist team.
L 05/05/2008 - 20:41:07: [restrict.smx] sm_restrict - Restricted the sg550 to 1 for the Counter-Terrorist team.
L 05/05/2008 - 20:41:07: [restrict.smx] sm_restrict - Restricted the g3sg1 to 1 for the Counter-Terrorist team.
But Counter-Terrorists have been able to buy a second AWP without problems :(

Liam 05-05-2008 23:47

Re: Weapon Restrictions
 
I'll attempt to recreate this error. Again though, I've not had any issues. *shrug*

Probably something I'm overlooking though. :)


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

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