Update 15th Jan 2007 (Afternoon)
Previously if a weapon was deleted from the map due to being restricted, even after unrestricting it, the weapon would not reappear until the map was reloaded.
The plugin now keeps track of weapons that are deleted and restores them if they are unrestricted, or if a replacement weapon is specified after it has been deleted.
All changes are effective on round start.
Update 15th Jan 2007
Changed weapon replace function to trigger on Round_Start because the first time the map is loaded, the weapons get removed as the function is called before the CVARS get set in AMXX.CFG
If the bots buy a restricted weapon, they are made to drop it immediately. But the bots continue to repeatedly buy and drop the same weapon 100's of times in 2 seconds. You end up with 100's of weapons on the floor and it lags out the server.
Fixed by dropping the weapon using a 1 second timer.
-----------------------------------------------------------------------------
Ok Plugin has been given a total overhaul.
Basically its the AMX Dev's Teams Restrict Weapon plugin with some modifications.
The default plugin only prevents players from buying weapons. But restricted weapons could still be picked up in maps such as fy_iceworld.
The modified plugin can replace all restricted weapons of a particular type with a weapon of another type. Example all AWP's can be turned into Scouts. All Auto Shotguns can be turned into M3's.
Hence players have no way to get a restricted weapon.
When playing with bots however the bots are not affected by the restrictions and can buy any weapon. So if a bot buys a restricted weapon, the bot automatically drops it.
In this case a player can pick up the restricted weapon which the bot dropped. So to prevent this, if a player gets his hands on a restricted weapon somehow it is automatically dropped.
DUE CREDITS:
Weapon drop logic borrowed from MagicShot's Advanced Weapon Restriction plugin.
Weapon remove / replace function suggested by
AndraX2000.
get_model_name() function borrowed from Cheap_Suit's Backweapons Plugin because i was too lazy to write all those 24 Switch-Case statements myself.
INSTRUCTIONS:
To restrict a weapon, simply use the default Restrict Weapon menu in AMX Mod X.
By default, any restricted weapons lying around the map are removed.
To replace them with another weapon you must change the corresponding CVAR.
amx_restrict_replace_awp "scout"
amx_restrict_replace_g3sg1 "m4a1"
etc.
If you have restricted a weapon without specifying a replacement and hence it gets removed from the map, if you want to get it back you must reload the map using
"changelevel" or
"restart". sv_restart or sv_restartround will not work. This is because it is completely removed from memory and has to be reloaded again. I'll add functionality to remember deleted weapons soon.
YOU CANNOT CHANGE A PRIMARY WEAPON INTO A SECONDARY WEAPON.
amx_restrict_replace_awp "deagle"
will cause the plugin to fail to replace any weapons at all.