My second and so biggest bit of coding yet!
This plugin gives players the ability to use smoke grenades in DoD for tactical purposes such as giving cover for breakouts and assaults.
I listened to a lot of suggestions from admins and players and have done my best to supply plenty of configuration to suit different maps and to stop idiots spamming them. I've also tried my best to minimize the graphical fps drops and lag that might occur. I've tested it on a real server with several players with machines of various specs and none reported any significant detrimental effects - however your mileage my vary.
Shot synopsis - player binds a key to the command "throw_smoke". Pressing the key throws a smoke grenade. How hard it is thrown depends on how high they aim up in the air. The smoke lasts a short while so it doesnt blanket the area for too long and isnt totally opaque so its really just for short-term cover.
Admins can enabled or disable the smoke grenades completely, enable or disable them per team or limit them to weapons of a certain role. They can also set a limit if the total grenades thrown per round is player or team based, e.g. you can set 2 per player or a total of 2 per team. This can be put in the server.cfg or map.cfg as needed.
Players have a configurable time delay after throwing before they can thrown another and another cvar controls how many at one time a team can have active in the map. There are also time delays on spawn and end of round to stop people letting them off in spawn.
I think thats about all you need to know!
I didnt use DODX because I wanted to keep this as low-level as possible and hopefully make it compatible with AMX.
This was built at tested with 0.16. If you want to try it out, bind a key to "throw_smoke" and test it on the following server:
67.19.63.72:27015
Code:
/* AMXX Mod script
*
* Smoke Grenades (for DoD 1.3, should work in any mod with a bit of alteration on sprites, weapon consts, etc.)
* by Neil 'Jed' Jedrzejewski
*
* Adds the ability to throw a smoke grenade
*
* Cvars:
* mp_smokegrenades 0/1 disable/enable the use of smoke grenades (on by default)
* mp_smokegren_axis_classes 63 axis classes allowed to use smoke grenades, see below
* mp_smokegren_allie_classes 63 allie classes allowed to use smoke grenades, see below
* mp_smokegren_msg 0/1 show the user messages relating to smoke grenades (on by default)
* mp_smokegren_mode 0/1 sets if smoke grenade limits are team or player based (0 = team, 1 = player)
* mp_smokegren_limit 2 sets how many grenades each player or team gets per round (default 2)
* mp_smokegren_atonce 2 how many smoke grenades can be on-screen at once per team (default is 2)
* mp_smokegren_delay 18.0 delay in seconds after the end of the smoke before the user can throw another
*
* Commands:
* amx_smoke <nick|id> Allow player to use smoke grenades (doesnt overide cvar limits)
* amx_nosmoke <nick|id> Prevents player from using smoke grenades (regardless of cvar limits)
amx_smokereset Rests the plugin if you find problems with some teams not having them
amd_smokedebug Displays debug info for the grenades (counter status, etc)
*
* Class limits for smoke greandes:
* You can set class limits on what sort of classes can use smoke grenades in a similar way to how
* class limits are set in DoD. Rather than limiting by each weapon the classes are grouped into
* 'roles' and limts are set on these. For example, rifles and carbines are one 'role', SMGs another, etc.
*
* Each class has a number associated with it. To enable smoke for those classes add together the numbers for
* the classes you want and set mp_smokegren_axis_classes or mp_smokegren_allies_classes to that number.
*
* Class numbers as as follows for all teams:
*
* Riflemen 1 (Rifles and carbines)
* Snipers 2 (Sniper rifles - duh!)
* SMGs 4 (Sub-Machine guns, e.g. Sten, MP40, Thompson, Greasegun)
* LMGs 8 (Bren, Bar, MP44, FG42 - MP44 and FG42 are here because of their calibre and power)
* MGs 16 (.30cal, MG34, MG42)
* AT Weapons 32 (PIAT, Panzershrek, Bazooka)
*
* So, for example of you want smoke grenades for the Axis for Riflemen, SMGs and LMGs use 1+4+8 = 13 so set
* mp_smokegren_axis_classes to 13. Easy huh? To enable it for all classes use 1+2+4+8+16+32 = 63.
*
* To disable smoke grenades for an entire team set the value to 0.
*
* Usage:
* Bind a key to "throw_smoke" to throw a smoke grenade
*
* Requirements:
* For AMX Mod X you'll need the fun and engine modules installed.
*/