AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   [INC] CS:S Get/Set dropped weapon's reserved ammo (https://forums.alliedmods.net/showthread.php?t=173650)

Peace-Maker 12-08-2011 12:17

[INC] CS:S Get/Set dropped weapon's reserved ammo
 
2 Attachment(s)
CS:S Get/Set dropped weapon's reserved ammo

These 2 stocks allow you to read and write the backpack ammo of any dropped weapon. The ammo is set as the reserved ammo of the player picking up that weapon.

PHP Code:

/**
 * Gets the reserved ammo of a dropped weapon.
 *
 * @param weapon        Weapon index.
 * 
 * @return              Reserved ammo for that weapon
 * @error                Weapon is not dropped, gamedata issues or offset not found.
 */
stock CS_GetDroppedWeaponAmmo(weapon);

/**
 * Sets the reserved ammo of a dropped weapon.
 *
 * @param weapon        Weapon index.
 * @param ammo          Amount of ammunition to set to.
 * 
 * @return              Reserved ammo for that weapon
 * @error                Weapon is not dropped, gamedata issues or offset not found.
 */
stock CS_SetDroppedWeaponAmmo(weaponammo); 

Users need the gamedata file next to your plugin, if you use this snippet. If the offset should change, you only need to link to the updated gamedata. No recompiling is required.

Thanks to psychonic sharing his assembler skills and writing up this include file initially!

TnTSCS 12-08-2011 12:42

Re: [INC] CS:S Get/Set dropped weapon's reserved ammo
 
nice!! Thanks again for everyone's help regarding this :)

Alex30555 12-08-2011 17:37

Re: [INC] CS:S Get/Set dropped weapon's reserved ammo
 
Nice

Thx ;)

Doc-Holiday 10-14-2012 20:06

Re: [INC] CS:S Get/Set dropped weapon's reserved ammo
 
any chance for this to work with csgo?

mukunda 10-18-2012 00:32

Re: [INC] CS:S Get/Set dropped weapon's reserved ammo
 
for cs:go i found the ammo value at 1452, or m_fAccuracyPenalty + 20, changing the "8" to "20" in the txt file should fix it for go!


All times are GMT -4. The time now is 18:38.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.