View Single Post
ShD3luxe
Member
Join Date: Aug 2019
Location: Localhost
Old 08-22-2019 , 09:13   Re: [CSGO] Fetch client's weapons, grenades, etc...
Reply With Quote #10

The weapon_teaser should be in the knife slot and the weapon_healthshot should be in the C4 slot.
Try printing the debug message like this to see if it detects those weapons(healthshot & teaser) before the StrEqual.
PHP Code:
stock bool WeaponsClientHasWeapon(int client, const char weapon[32])
{
    
// Get all of client's current weapons.
    
int weapons[WeaponsSlot];
    
WeaponsGetClientWeapons(clientweapons);
    
    
char classname[64];
    
    
// x = slot index
    
for (int x 0WEAPONS_SLOTS_MAXx++)
    {
        
// If slot is empty, then stop.
        
if (weapons[x] == -1)
        {
            continue;
        }
        
        
// If the weapon's classname matches, then return true.
        
GetEdictClassname(weapons[x], classnamesizeof(classname));
        
//ReplaceString(classname, sizeof(classname), "weapon_", "");
        
PrintToChat(client,"[DEBUG] User weapon %s | Weapon to check for : %s",classname,weapon);

        if (
StrEqual(weaponclassnamefalse))
        {
            return 
true;
        }
    }   
    return 
false;

Also it doesn't matter the order you have the functions declared.
For more tests try adding a cmd function !test to call the checking weapons function and see if then it detects if you have healthshot or teaser.

Last edited by ShD3luxe; 08-22-2019 at 09:35.
ShD3luxe is offline