AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   CS:GO Fix for reserve ammo patch. (Set Clip Ammo & Clips Remaining) [4/28/2015 Patch] (https://forums.alliedmods.net/showthread.php?t=262841)

ImACow 05-13-2015 15:18

CS:GO Fix for reserve ammo patch. (Set Clip Ammo & Clips Remaining) [4/28/2015 Patch]
 
Sharing my snippet that allows me to use it just like before the 4/28/2015 Patch

There is no checking for valid entities since that has been done before I call these stocks
PHP Code:

/*
 * Gets the primary clip count of a weapon.
 * 
 * @param weapon        Weapon Entity.
 * @return                Primary Clip count.
 */
stock lib_GetPrimaryAmmo(weapon)
{
    return 
GetEntProp(weaponProp_Data"m_iClip1");
}
/*
 * Sets the primary ammo count of a weapon.
 * 
 * @param weapon        Weapon Entity.
 * @param value            Clip Count value.
 */
stock lib_SetPrimaryAmmo(weapon,ammo)
{
    
SetEntProp(weaponProp_Data"m_iClip1"ammo);
}
/*
 * Gets the secondary clip count of a weapon.
 * 
 * @param weapon        Weapon Entity.
 * @return                Primary Clip count.
 */
stock lib_GetSecondaryAmmo(weapon)
{
    return     
GetEntProp(weaponProp_Send"m_iPrimaryReserveAmmoCount");
}
/*
 * Sets the secondary ammo count of a weapon.
 * 
 * @param weapon        Weapon Entity.
 * @param value            Clip Count value.
 */
stock lib_SetSecondaryAmmo(weapon,ammo)
{
    
SetEntProp(weaponProp_Send"m_iPrimaryReserveAmmoCount"ammo);
}
/*
 * Sets the primarty and secondary ammo count of a weapon.
 * 
 * @param weapon        Weapon Entity.
 * @param value            Primary ammo Count value.
 * @param value            Primary ammo Count value.
 */
stock lib_SetWeaponAmmo(weapon,primaryammo,secondaryammo)
{
    
lib_SetPrimaryAmmo(weaponprimaryammo);
    
lib_SetSecondaryAmmo(weaponsecondaryammo);
}
/*
 * Gets the primary and secondary clip count of a weapon.
 * 
 * @param weapon                     Weapon Entity.
 * @param primaryammo                Primary Clip count.
 * @param secondaryammo                Secondary Clip count.
 */
stock lib_GetWeaponAmmo(weapon,&primaryammo,&secondaryammo)
{
    
primaryammo lib_GetPrimaryAmmo(weapon);
    
secondaryammo lib_GetSecondaryAmmo(weapon);


Doing lib_SetWeaponAmmo(weapon,0,0)
results into
http://i.imgur.com/7Q5Jyq7.png

sneaK 05-18-2015 12:44

Re: CS:GO Fix for reserve ammo patch. (Set Clip Ammo & Clips Remaining) [4/28/2015 Pa
 
Thanks for this!

I'm a bit clueless when it comes to this department, but if I wish to implement this server-wide so it works just as it did before, how would I go about doing this?

A couple examples; I run a couple hungergames maps where you're supposed to get a gun out of a box that only gives you 1 reserve bullet and a full first magazine, but now it gives you full reserve ammo. Also, during gungame maps, when on nade level, the player is given a deagle with only 7 rounds and no reserve ammo, but now they have full reserve ammo.

Thank you!

Hallucinogenic Troll 05-30-2015 10:16

Re: CS:GO Fix for reserve ammo patch. (Set Clip Ammo & Clips Remaining) [4/28/2015 Pa
 
I'm sorry, I'm kind of big noob with scripting.

Can you make a plugin with that snippet with 1000 reserve ammo on each weapon? its for a MG/SURF server.
If you don't want to post here, add me on steam (same name, with 20+ lvl profile, from Portugal).


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

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