New version is here:
Thanks to Lebson506th
My first plugin for sourcemod is ready.
This plugin allows you to give any weapon to any class and it allows to modify the weapons ammunitions on the fly.
It has been tested on 2 dods servers and it works and compiles.
Since version 0.0.6 every weapon and ammo change was tested and works.
I want to thank strontiumdog
for his [DODS] Pistols UPDATED July 15, 2008
code. He made me understand the m_iAmmo offsets faster.
I want to thank teame06
for his GunGame:SM
code. His code made me able to understand the virtual function handling faster.
This Plugin will not work with any other nightly sourcemod builds older than 1.1.0-r2400.
According to Lee this plugin also works with 1.0.4svn.
Maybe it will work on other version (with exception of the 1.0.3 release, this version is not compatible), i have not tested it.
If you assign more than 4 different weapons you aren't able to select all of them with keys. Throwing some weapons away is one of the workarrounds. If you assign a value greater than 9999 to the ammo, the clips get a random size. This is due to array memory limitations.
Next improvements & CURRENT VERSION 0.0.6:
- DONE: (planned this week) Nicer code and the use of functions (0.0.2).
- DONE-partially: Support for removing equipment on the fly (0.0.3).
- FIXED: fixed the riflegren bug. You can now set the amount of riflegrens for the rifleman class. (0.0.4)
- DONE: Nicer code and more errortesting (0.0.4)
- FIXED: Fixed a mg ammo bug. You can now set the mg ammo. (0.0.5)
- FIXED: Refixed the mg ammo, i have tested it and it works now. sorry for the mistake... (0.0.6)
- Includes for other plugins so you can equip on a given event. (Chancelled due to the possibility to exec configs. If someone wants this feature message me.)
- Set the equipment for single players.
The CSS version is comming soon.
- Upload the .cfg into <DoDModDir>/cfg/sourcemod
- Upload the .smx file into <DoDModDir>/addons/sourcemod/plugins
- Type into HLSW or into the gameserver console: sm plugins refresh
Be shure to get the new config. All cvar names are changed.
- Upload the new dod_equip.smx into the <DoDModDir>/addons/sourcemod/plugins folder.
- Upload the new dod_equip.cfg into <DoDModDir>/cfg/sourcemod
- type into the hlsw or into the gameserver console:
sm plugins list
you will get a list with loaded plugins. The list has the form
"NUM Name Author ..."
Remember the NUM and type into the console
- sm plugins unload NUM
- sm plugins refresh
Sorry for this change but in the jungle of server cvars its important to have them structured.
They will not be changed again.
You can only assign 4 whitespace seperated values in one cvar.
The ammo numbers are not allowed to exceed 9999!!!!!!!!
The configuration file holds 3 server cvars for each class.
The first cvar is used to remove all equipment from the class before the assignment of any other equipment.
The second cvar for one class is the equipment cvar. You set the weapons in this cvar.
The third cvar is the corresponding ammunition cvar. You set the weapon ammo corresponding to the the weapon, whitch was set in the equipment cvar.
Every weapon an every ammo assignment needs to be seperated with a whitespace.
Every weapon assignment needs a ammo asignment.
If you set the clear cvars to "yes" all weapons are removed prior to equiping. This means only the weapons equiped in the cvars are aviable to the players.
Here are two examples that have the same result:
sm_equip_rifle_equip_ger "weapon_riflegren_ger weapon_p38"
sm_equip_rifle_ammo_ger "3 80"
sm_equip_rifle_equip_ger "weapon_p38 weapon_riflegren_ger"
sm_equip_rifle_ammo_ger "80 3"
Example 999 ammo for the assault class primary weapon 3 smokes and 3 frags:
sm_equip_assault_equip_us "weapon_thompson weapon_smoke_us weapon_frag_us"
sm_equip_assault_ammo_us "999 3 3"
Example 999 bullets for the us sniper. The us sniper also gets the 30cal with 9999 bullets, the colt with 70 bullets and 3 frag grenades.
After coding version 0.0.3 of this plugin i found a possible workarround to let the sniper class select the mg. If it works i will post it here.
sm_equip_sniper_equip_us "weapon_30cal weapon_spring weapon_colt weapon_frag_us"
sm_equip_sniper_ammo_us "9999 999 70 3"
Have fun with the plugin.