Raised This Month: $ Target: $400
 0% 

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


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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, 393 views)
File Type: txt cssdroppedammo.txt (445 Bytes, 461 views)
__________________
Peace-Maker is offline
 



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 18:38.


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