View Single Post
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 08-22-2020 , 08:53   Re: Weird bug in Counter-Strike: Source – Night vision gives ammo
Reply With Quote #7

Was looking... source code.

Seems when use command buy item/weapon,
all weapons, item_kevlar(vest), item_assaultsuit(vesthelm), item_nvgs(nvgs) are using this function, except item_defuser
PHP Code:
CCSPlayer::GiveNamedItem( const char *pszNameint iSubType 
...which will StockPlayerAmmo( pWeapon ); at end of code.

if StockPlayerAmmo( pWeapon ); fail find entity as CWeaponCSBase, for example nvgs+vesthelm+vest,
it will then refill both, primary and secondary weapons ammo

This also happen to all items (nvgs, vest, vesthelm, defuser) with command give and SourceMod function GivePlayerItem,
it will refill primary and secondary weapons ammo.


But if those items are created by ent_create, it won't stock ammo.

---------------

I tried made plugin but I don't have time. There is many ways to get ammo (buyammo1, buyammo2, cl_rebuy "PrimaryWeapon PrimaryAmmo Defuser Armor HEGrenade Flashbang SmokeGrenade SecondaryWeapon SecondaryAmmo NightVision" and so on).
not perfect
__________________
Do not Private Message @me

Last edited by Bacardi; 08-22-2020 at 08:55.
Bacardi is offline