View Single Post
Author Message
NatalyaAF
Senior Member
Join Date: Dec 2008
Old 09-26-2009 , 21:36   [CSS] Weapon Spawning Menu
Reply With Quote #1

Weapon Spawning Menu

Description:

This plugin creates a sm_weapons command which players can use either with a bind, or in most cases by typing !weapons into chat. The plugin comes with three CVARs to provide some basic functionality to server operators.


CVARs
sm_weapons_enabled (Default 1) -- When set to 1 the weapons menu will operate. When set to 0 no one can use it.
sm_weapons_ct (Default 1) -- When set to 1 Counter-Terrorists can use the menu.
sm_weapons_t (Default 1) -- When set to 1 Terrorists can use the menu.
sm_weapons_version -- Broadcasted version CVAR.

This is useful if you want to disable it on certain maps, or perhaps you run a Zombie Mod server and you only want humans (CT's) spawning guns.


Version Info:

01.00

Initial release.


Installation:
Put sm_weapons.smx in sourcemod/plugins and restart your server or do sm plugins load sm_weapons to load the plugin.


Customizing:
I can think of two reasons for which you would customize this... Either so that you can add more equipment (grenades or defuse kit) or disable some weapons (maybe awps or autos). So here I will show you how.

Adding Grenades:

1. Go to the handle where it builds the Equipment menu -- it should say this:
Handle:BuildEquipMenu()

2. Find the line for Night Vision:
AddMenuItem(equip, "item_nvgs", "Night Vision")

3. Directly below it add the following:
AddMenuItem(equip, "weapon_hegrenade", "HE Grenade")

Bam you are done. Compile the plugin, re-upload, and reset the server or reload the plugin.
Now let's say you wanted to disable Auto-Snipers...

1. Go to the handle where it builds the Sniper Rifle menu:
Handle:BuildSniperMenu()

2. Look for the Auto-Snipers:
AddMenuItem(snipers, "weapon_sg550", "SG550")
AddMenuItem(snipers, "weapon_g3sg1", "G3/SG1")

3. All you gotta do is replace weapon_sg550 and weapon_g3sg1 with 0's and add before the closing ) ITEMDRAW_DISABLED. It should look like this:
AddMenuItem(snipers, "0", "SG550", ITEMDRAW_DISABLED)
AddMenuItem(snipers, "0", "G3SG1", ITEMDRAW_DISABLED)

4. Once again you are done. This will show the auto-snipers grayed out to whoever looks in the sniper menu. You could just delete their lines but I think greying them out looks cool. In any case, re-compile, re-upload, and re-load and voila, no more autos. These operations can obviously be done for any other weapon, following this example.



Anyway, that's about it. If you have problems post here, but please don't criticize me too harshly; this is my first plugin.
Attached Files
File Type: sp Get Plugin or Get Source (sm_weapons.sp - 9330 views - 9.4 KB)

Last edited by NatalyaAF; 09-27-2009 at 04:39.
NatalyaAF is offline