Raised This Month: $ Target: $400
 0% 

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


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Peace-Maker
SourceMod Plugin Approver
Join Date: Aug 2008
Location: Germany
Old 12-08-2011 , 12:17   [INC] CS:S Get/Set dropped weapon's reserved ammo
Reply With Quote #1

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!
Attached Files
File Type: inc cssdroppedammo.inc (2.5 KB, 392 views)
File Type: txt cssdroppedammo.txt (445 Bytes, 458 views)
__________________
Peace-Maker is offline
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 12-08-2011 , 12:42   Re: [INC] CS:S Get/Set dropped weapon's reserved ammo
Reply With Quote #2

nice!! Thanks again for everyone's help regarding this
TnTSCS is offline
Alex30555
Member
Join Date: Sep 2011
Location: Paris
Old 12-08-2011 , 17:37   Re: [INC] CS:S Get/Set dropped weapon's reserved ammo
Reply With Quote #3

Nice

Thx ;)
Alex30555 is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 10-14-2012 , 20:06   Re: [INC] CS:S Get/Set dropped weapon's reserved ammo
Reply With Quote #4

any chance for this to work with csgo?
Doc-Holiday is offline
mukunda
Member
Join Date: Sep 2012
Old 10-18-2012 , 00:32   Re: [INC] CS:S Get/Set dropped weapon's reserved ammo
Reply With Quote #5

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!
mukunda is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 22:23.


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