PDA

View Full Version : Simple Weapon Restriction


WhiteWolf
10-24-2007, 00:51
Fairly simple weapon restriction plugin, listed/tested on CS:S but should work for any source based game.

Note: Does not refund any money for lost items or alert the player that the weapon is restricted. This is due to simplicity of the need on my servers. I am simply releasing this plugin for anyone who can make use of it. I suggest advertising your restricted weapons.

Note2: When restricting items, it is necessary to include the full name of the weapon. For example: sm_restrict weapon_awp

Note3: Won't work with TF2 until I get the offsets for it.

Commands/cvars:
sm_restrict <weapon> ; restricts a weapon from being picked up/bought
sm_round_restrict <weapon ; restricts a weapon from being retained the next round
sm_unrestrict <weapon> ; removes a pickup/bought restriction
sm_round_unrestrict ; removes a start of round weapon restriction

cvars:
sm_enable_restrict 1/0 ; enables buy/pickup restrictions
sm_enable_round_restrict 1/0 ; enables/disables round-start restrictions
sm_roundcheck_delay <float seconds> ; the seconds from player spawn items are checked/removed -- needs to be about 0.2 in my experimentation

I'll entertain bug fixes and simple feature requests.

Credit given where credit due:
devicenull - Original code [that now doesn't work] and helping me with a couple portions and entertaining me while I bugged him.
dalto - Sell!; offsets to Weapon_Equip

ferret
10-24-2007, 11:22
We can't approve a plugin that admits there may be a handle memory leak. Please look into and resolve that if you wish for the plugin to be approved.

WhiteWolf
10-24-2007, 12:02
My plugin doesn't have any handle leaks as far as I can tell, including BAILOPAN reviewing the code.

However, due to the fact one of the features of it uses GetMaxClients()/playercount one-shot timers every round -- it can reveal possible problems with the actual backend code in SourceMod dealing with timers, not necessarily my plugin. A conclusion I've been unable to support [except for a 600KB handles file with a bunch of timers] because it does not occur since revision 1600 thus far... hopefully it was fixed.

red!
10-24-2007, 12:59
looks like a nice light-weight plugin. but for my personal needs I miss some kind of team-based restrictions ...

^BuGs^
10-24-2007, 22:47
There are a few memory leaks.

ModL.
11-10-2007, 19:15
Its kool and does everythink i want it too, can sombody edit the text so it doesnt say "checking for round restricted items.." so it doesnt say anythink.

thanks

shamans
11-18-2007, 11:39
Hi ! this plugin doesn't work with TF2???
It give me <error> when I load it.

Norwegian Pirate
12-04-2007, 22:05
Does this plugin even work? and what is memory leak?


EDIT: Can this plugin restrict flashbang?

WhiteWolf
12-05-2007, 15:17
It works, the memory leak was a sourcemod bug that was fixed.

It can restrict flashbangs... use weapon_flashbang

Updated to fix a couple bugs... see original post.

Bloodlvst
12-05-2007, 15:21
I currently use Bugs' solutoni, and I'm looking for a simpler plugin. The only thing stopping me is that we need the ability to restrict a weapon to X per team.

Do you know if you can do this? If not, now worries, I'm just curious. :)

Shadowdogg
04-22-2008, 16:00
I currently use Bugs' solutoni, and I'm looking for a simpler plugin. The only thing stopping me is that we need the ability to restrict a weapon to X per team.

Do you know if you can do this? If not, now worries, I'm just curious. :)

Same and bugs' one doesn't even properly restrict for me for x per team

Liam
04-22-2008, 22:21
I just posted up my weapon restriction mod. Works fine on CSS. :)

MoggieX
06-21-2008, 10:00
Just been testing this plugin, found that the hooked event for "weapon_fire" was causing some adverse lagging, remove it and its function Event_WeaponFire() and its mile better.

Thats worked for us, as we do not have any maps where AWP or auto snipers (our restricted weapons) are already spawned by the map itself

Matt

HSFighter
08-06-2008, 19:42
Thx for this nice plugin.
I use it on my first NO-AWP Server, and it's work great :-)

But... bot's can use restricted weapons.
I it possible to add restriction even for Bot's?

Liam
08-06-2008, 22:55
The restrict plugin I posted will handle bots as well as live players. :) I'm not sure if this is still supported or not.

Iron_Chef
11-05-2008, 12:52
This shows up every minute or two in my logs... I think it may be the main contributing factor to accumulating lag spikes... the farther into the day the server goes without being restarted, the worse the lag spikes get.

L 11/05/2008 - 10:55:50: [SM] Native "GetEdictClassname" reported: Invalid edict (122)
L 11/05/2008 - 10:55:50: [SM] Displaying call stack trace for plugin "wwrestrict.smx":
L 11/05/2008 - 10:55:50: [SM] [0] Line 295, wwrestrict.sp::RemoveWeapons()
L 11/05/2008 - 10:55:50: [SM] [1] Line 192, wwrestrict.sp::CheckPlayer()

KiloGames
12-30-2008, 00:12
I want to let you know this plugin isn't working. I'm running the most current version of SourceMod, and Source MetaMod,a s of 12/29/2008. It tells me in game it is checking peoples load outs, and I have an awp in hand and can use it.

I have this variable in my server.cfg sm_restrict awp, and I type in the server console, and it tells me it's already restricted, yet I can still use the awp.

JaToch
04-08-2009, 16:23
I am sorry for a BUMP. But I really would like to have a plugin like this.
And I've been looking for hours on google to find something do:
restrict weapons for the next round
give XX weapon on the next round
and return to normal (no restrictions) at the end of the round
So it's only a 1 weapon round, like a knife round or AWP round or Deagle round, but that's ma_knives on manimod.
Is there anyone who knows a comparable script/plugin?
Thanks in advance.

HSFighter
08-30-2010, 17:56
This plugin works fine on my Server. (OB-Engine)

CynderWolf
11-03-2010, 18:30
Is there any possible way you could make/edit this mod for use on TF2? I would just need it to be able to restrict certain weapons for certain classes.

For example: Restrict the Sniper Rifle and the Sydney Sleeper for the Sniper, thus only allowing the Sniper to use the Huntsman.

Thanks a ton, the plugin looks nice so far, I just need it ported to TF2. Hope to hear from you soon. :3