View Single Post
akcaliberg
Senior Member
Join Date: Nov 2011
Location: Istanbul
Old 06-14-2018 , 09:34   Re: [HELP] Infinite ammo?
Reply With Quote #12

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(iClientCS_SLOT_PRIMARY) || weapon == GetPlayerWeaponSlot(iClientCS_SLOT_SECONDARY)) 
Other than those, there should be no problem. Make sure this function is returning true:

PHP Code:
VIP_IsClientFeatureUse(iClientBULLETS
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[] namebool bIsVIP)
{
    
int iClient GetClientOfUserId(GetEventInt(event"userid"));
    
    
int weapon GetEntPropEnt(iClientProp_Data"m_hActiveWeapon");
    
char classname[32];
    
GetEdictClassname(weaponclassnamesizeof(classname));

    if(
IsPlayerAlive(iClient/*&& bIsVIP &&  VIP_IsClientFeatureUse(iClient, BULLETS)*/)
    {
        if(
weapon && (weapon == GetPlayerWeaponSlot(iClientCS_SLOT_PRIMARY) || weapon == GetPlayerWeaponSlot(iClientCS_SLOT_SECONDARY)))
        {
            if (
StrContains(classname"weapon_"false) != -1)
            {
                
SetEntProp(weaponProp_Send"m_iClip1"32);
                
SetEntProp(weaponProp_Send"m_iClip2"32);    
            }
        }
    }


Last edited by akcaliberg; 06-14-2018 at 09:38.
akcaliberg is offline