As someone else said you should check StrContains return value against -1
Also this code may prevent players from having unlimited ammo if there is another weapon in the same slot
PHP Code:
(weapon == GetPlayerWeaponSlot(iClient, CS_SLOT_PRIMARY) || weapon == GetPlayerWeaponSlot(iClient, CS_SLOT_SECONDARY))
Other than those, there should be no problem. Make sure this function is returning true:
PHP Code:
VIP_IsClientFeatureUse(iClient, BULLETS)
as well as the bIsVIP variable.
This code works without a problem on my CS:GO server:
PHP Code:
public Action ClientWeaponReload(Handle event, const char[] name, bool bIsVIP)
{
int iClient = GetClientOfUserId(GetEventInt(event, "userid"));
int weapon = GetEntPropEnt(iClient, Prop_Data, "m_hActiveWeapon");
char classname[32];
GetEdictClassname(weapon, classname, sizeof(classname));
if(IsPlayerAlive(iClient) /*&& bIsVIP && VIP_IsClientFeatureUse(iClient, BULLETS)*/)
{
if(weapon > 0 && (weapon == GetPlayerWeaponSlot(iClient, CS_SLOT_PRIMARY) || weapon == GetPlayerWeaponSlot(iClient, CS_SLOT_SECONDARY)))
{
if (StrContains(classname, "weapon_", false) != -1)
{
SetEntProp(weapon, Prop_Send, "m_iClip1", 32);
SetEntProp(weapon, Prop_Send, "m_iClip2", 32);
}
}
}
}