Hey,
when I want to set player ammo with this func below and when I use clip or ammo to 0, weapon clip or ammo is set to default ammo or clip value, like when it's deagle it sets to 7/35 using:
PHP Code:
SetPlayerAmmo(client, iWep, 0, 0);
Function:
PHP Code:
stock void SetPlayerAmmo(int client, int weaponEnt, int clip = -1, int ammo = -1)
{
if (weaponEnt == INVALID_ENT_REFERENCE || !IsValidEntity(weaponEnt))
return;
if (clip != -1)
SetEntProp(weaponEnt, Prop_Send, "m_iClip1", clip);
if (ammo != -1)
{
int iOffset = FindDataMapInfo(client, "m_iAmmo") + (GetEntProp(weaponEnt, Prop_Data, "m_iPrimaryAmmoType") * 4);
SetEntData(client, iOffset, ammo, 4, true);
if (GetEngineVersion() == Engine_CSGO)
{
SetEntProp(weaponEnt, Prop_Send, "m_iPrimaryReserveAmmoCount", ammo);
}
}
}
btw. no errors in error log
__________________