Raised This Month: $51 Target: $400
 12% 

Solved [CSGO] Fetch client's weapons, grenades, etc...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
JoaoRodrigoGamer
Junior Member
Join Date: Jul 2019
Location: Portugal
Old 08-22-2019 , 05:01   [CSGO] Fetch client's weapons, grenades, etc...
Reply With Quote #1

I've been trying to write a plugin that gives weapons, grenades, etc. to players.
Until now, everything is working fine. I can give the items to client's and they get them. The problem is that in every round the script gives those items but I would like to check if they have, for example, a health shot or a taser, before giving them to the client.

Any ideas to how I can accomplish this?

Last edited by JoaoRodrigoGamer; 08-23-2019 at 07:09. Reason: Solved
JoaoRodrigoGamer is offline
ShD3luxe
Member
Join Date: Aug 2019
Location: Localhost
Old 08-22-2019 , 05:25   Re: [CSGO] Fetch client's weapons, grenades, etc...
Reply With Quote #2

From the Zombie Reloaded api :
Code:
/**
 * General weapon API.
 */

/**
 * Maximum length of a weapon name string
 */
#define WEAPONS_MAX_LENGTH 32

/**
 * Number of weapon slots (For CS:S)
 */
#define WEAPONS_SLOTS_MAX 5

/**
 * Weapon slots.
 */
enum WeaponsSlot
{
    Slot_Invalid        = -1,   /** Invalid weapon (slot). */
    Slot_Primary        = 0,    /** Primary weapon slot. */
    Slot_Secondary      = 1,    /** Secondary weapon slot. */
    Slot_Melee          = 2,    /** Melee (knife) weapon slot. */
    Slot_Projectile     = 3,    /** Projectile (grenades, flashbangs, etc) weapon slot. */
    Slot_Explosive      = 4,    /** Explosive (c4) weapon slot. */
}

/**
 * Checks if a client has a specific weapon.
 * 
 * @param client    The client index.
 * @param weapon    The weapon classname.
 */
stock bool:WeaponsClientHasWeapon(client, const String:weapon[])
{
    // Get all of client's current weapons.
    new weapons[WeaponsSlot];
    WeaponsGetClientWeapons(client, weapons);
    
    decl String:classname[64];
    
    // x = slot index
    for (new x = 0; x < WEAPONS_SLOTS_MAX; x++)
    {
        // If slot is empty, then stop.
        if (weapons[x] == -1)
        {
            continue;
        }
        
        // If the weapon's classname matches, then return true.
        GetEdictClassname(weapons[x], classname, sizeof(classname));
        ReplaceString(classname, sizeof(classname), "weapon_", "");
        if (StrEqual(weapon, classname, false))
        {
            return true;
        }
    }
    
    return false;
}

/**
 * Return an array that contains all client's weapon indexes.
 * 
 * @param client    The client index.
 * @param weapons   The weapon index array.
 *                  -1 if no weapon in slot. 
 */
stock WeaponsGetClientWeapons(client, weapons[WeaponsSlot])
{
    // x = Weapon slot.
    for (new x = 0; x < WEAPONS_SLOTS_MAX; x++)
    {
        weapons[x] = GetPlayerWeaponSlot(client, x);
    }
}

/**
 * Returns weapon index of the client's deployed weapon.
 * 
 * @param client    The client index.
 * @return          The weapon index of the deployed weapon.
 *                  -1 if no weapon is deployed. 
 */
stock WeaponsGetDeployedWeaponIndex(client)
{
    // Return the client's active weapon.
    return GetEntDataEnt2(client, offsActiveWeapon);
}

/**
 * Returns slot of client's deployed weapon.
 *
 * @param client    The client index.
 * @return          The slot number of deployed weapon.
 */
stock WeaponsSlot:WeaponsGetDeployedWeaponSlot(client)
{
    // Get all client's weapon indexes.
    new weapons[WeaponsSlot];
    WeaponsGetClientWeapons(client, weapons);
    
    // Get client's deployed weapon.
    new deployedweapon = WeaponsGetDeployedWeaponIndex(client);
    
    // If client has no deployed weapon, then stop.
    if (deployedweapon == -1)
    {
        return Type_Invalid;
    }
    
    // x = weapon slot.
    for (new x = 0; x < WEAPONS_SLOTS_MAX; x++)
    {
        if (weapons[x] == deployedweapon)
        {
            return WeaponsSlot:x;
        }
    }
    
    return Type_Invalid;
}
Example of use:
Code:
#include <sourcemod>
#include <sdktools>

#define WEAPONS_MAX_LENGTH 32
#define WEAPONS_SLOTS_MAX 5

enum WeaponsSlot
{
    Slot_Invalid        = -1,   /** Invalid weapon (slot). */
    Slot_Primary        = 0,    /** Primary weapon slot. */
    Slot_Secondary      = 1,    /** Secondary weapon slot. */
    Slot_Melee          = 2,    /** Melee (knife) weapon slot. */
    Slot_Projectile     = 3,    /** Projectile (grenades, flashbangs, etc) weapon slot. */
    Slot_Explosive      = 4,    /** Explosive (c4) weapon slot. */
};
public OnPluginStart()
{
	RegConsoleCmd("sm_test",TestCMD);
}
public Action:TestCMD(client,args)
{
	bool hasWeapon = WeaponsClientHasWeapon(client,"weapon_healthshot");
	if(hasWeapon)
	{
		PrintToChatAll("Has healthshot");
	}
}
stock bool:WeaponsClientHasWeapon(client, const String:weapon[])
{
    // Get all of client's current weapons.
    new weapons[WeaponsSlot];
    WeaponsGetClientWeapons(client, weapons);
    
    decl String:classname[64];
    
    // x = slot index
    for (new x = 0; x < WEAPONS_SLOTS_MAX; x++)
    {
        // If slot is empty, then stop.
        if (weapons[x] == -1)
        {
            continue;
        }
        
        // If the weapon's classname matches, then return true.
        GetEdictClassname(weapons[x], classname, sizeof(classname));
        ReplaceString(classname, sizeof(classname), "weapon_", "");
        if (StrEqual(weapon, classname, false))
        {
            return true;
        }
    }   
    return false;
}
stock WeaponsGetClientWeapons(client, weapons[WeaponsSlot])
{
    // x = Weapon slot.
    for (new x = 0; x < WEAPONS_SLOTS_MAX; x++)
    {
        weapons[x] = GetPlayerWeaponSlot(client, x);
    }
}

Last edited by ShD3luxe; 08-22-2019 at 05:36. Reason: Better example
ShD3luxe is offline
JoaoRodrigoGamer
Junior Member
Join Date: Jul 2019
Location: Portugal
Old 08-22-2019 , 06:12   Re: [CSGO] Fetch client's weapons, grenades, etc...
Reply With Quote #3

Quote:
Originally Posted by ShD3luxe View Post
From the Zombie Reloaded api :
Code:
/**
 * General weapon API.
 */

/**
 * Maximum length of a weapon name string
 */
#define WEAPONS_MAX_LENGTH 32

/**
 * Number of weapon slots (For CS:S)
 */
#define WEAPONS_SLOTS_MAX 5

/**
 * Weapon slots.
 */
enum WeaponsSlot
{
    Slot_Invalid        = -1,   /** Invalid weapon (slot). */
    Slot_Primary        = 0,    /** Primary weapon slot. */
    Slot_Secondary      = 1,    /** Secondary weapon slot. */
    Slot_Melee          = 2,    /** Melee (knife) weapon slot. */
    Slot_Projectile     = 3,    /** Projectile (grenades, flashbangs, etc) weapon slot. */
    Slot_Explosive      = 4,    /** Explosive (c4) weapon slot. */
}

/**
 * Checks if a client has a specific weapon.
 * 
 * @param client    The client index.
 * @param weapon    The weapon classname.
 */
stock bool:WeaponsClientHasWeapon(client, const String:weapon[])
{
    // Get all of client's current weapons.
    new weapons[WeaponsSlot];
    WeaponsGetClientWeapons(client, weapons);
    
    decl String:classname[64];
    
    // x = slot index
    for (new x = 0; x < WEAPONS_SLOTS_MAX; x++)
    {
        // If slot is empty, then stop.
        if (weapons[x] == -1)
        {
            continue;
        }
        
        // If the weapon's classname matches, then return true.
        GetEdictClassname(weapons[x], classname, sizeof(classname));
        ReplaceString(classname, sizeof(classname), "weapon_", "");
        if (StrEqual(weapon, classname, false))
        {
            return true;
        }
    }
    
    return false;
}

/**
 * Return an array that contains all client's weapon indexes.
 * 
 * @param client    The client index.
 * @param weapons   The weapon index array.
 *                  -1 if no weapon in slot. 
 */
stock WeaponsGetClientWeapons(client, weapons[WeaponsSlot])
{
    // x = Weapon slot.
    for (new x = 0; x < WEAPONS_SLOTS_MAX; x++)
    {
        weapons[x] = GetPlayerWeaponSlot(client, x);
    }
}

/**
 * Returns weapon index of the client's deployed weapon.
 * 
 * @param client    The client index.
 * @return          The weapon index of the deployed weapon.
 *                  -1 if no weapon is deployed. 
 */
stock WeaponsGetDeployedWeaponIndex(client)
{
    // Return the client's active weapon.
    return GetEntDataEnt2(client, offsActiveWeapon);
}

/**
 * Returns slot of client's deployed weapon.
 *
 * @param client    The client index.
 * @return          The slot number of deployed weapon.
 */
stock WeaponsSlot:WeaponsGetDeployedWeaponSlot(client)
{
    // Get all client's weapon indexes.
    new weapons[WeaponsSlot];
    WeaponsGetClientWeapons(client, weapons);
    
    // Get client's deployed weapon.
    new deployedweapon = WeaponsGetDeployedWeaponIndex(client);
    
    // If client has no deployed weapon, then stop.
    if (deployedweapon == -1)
    {
        return Type_Invalid;
    }
    
    // x = weapon slot.
    for (new x = 0; x < WEAPONS_SLOTS_MAX; x++)
    {
        if (weapons[x] == deployedweapon)
        {
            return WeaponsSlot:x;
        }
    }
    
    return Type_Invalid;
}
Example of use:
Code:
#include <sourcemod>
#include <sdktools>

#define WEAPONS_MAX_LENGTH 32
#define WEAPONS_SLOTS_MAX 5

enum WeaponsSlot
{
    Slot_Invalid        = -1,   /** Invalid weapon (slot). */
    Slot_Primary        = 0,    /** Primary weapon slot. */
    Slot_Secondary      = 1,    /** Secondary weapon slot. */
    Slot_Melee          = 2,    /** Melee (knife) weapon slot. */
    Slot_Projectile     = 3,    /** Projectile (grenades, flashbangs, etc) weapon slot. */
    Slot_Explosive      = 4,    /** Explosive (c4) weapon slot. */
};
public OnPluginStart()
{
	RegConsoleCmd("sm_test",TestCMD);
}
public Action:TestCMD(client,args)
{
	bool hasWeapon = WeaponsClientHasWeapon(client,"weapon_healthshot");
	if(hasWeapon)
	{
		PrintToChatAll("Has healthshot");
	}
}
stock bool:WeaponsClientHasWeapon(client, const String:weapon[])
{
    // Get all of client's current weapons.
    new weapons[WeaponsSlot];
    WeaponsGetClientWeapons(client, weapons);
    
    decl String:classname[64];
    
    // x = slot index
    for (new x = 0; x < WEAPONS_SLOTS_MAX; x++)
    {
        // If slot is empty, then stop.
        if (weapons[x] == -1)
        {
            continue;
        }
        
        // If the weapon's classname matches, then return true.
        GetEdictClassname(weapons[x], classname, sizeof(classname));
        ReplaceString(classname, sizeof(classname), "weapon_", "");
        if (StrEqual(weapon, classname, false))
        {
            return true;
        }
    }   
    return false;
}
stock WeaponsGetClientWeapons(client, weapons[WeaponsSlot])
{
    // x = Weapon slot.
    for (new x = 0; x < WEAPONS_SLOTS_MAX; x++)
    {
        weapons[x] = GetPlayerWeaponSlot(client, x);
    }
}
I'm trying to convert that to the new syntax but with no success... Do you know where can I find a version adapted to the new syntax?
JoaoRodrigoGamer is offline
ShD3luxe
Member
Join Date: Aug 2019
Location: Localhost
Old 08-22-2019 , 06:31   Re: [CSGO] Fetch client's weapons, grenades, etc...
Reply With Quote #4

Here , I modified the code with the new syntax.
Code:
#include <sourcemod>
#include <sdktools>

#pragma newdecls required 
#define WEAPONS_MAX_LENGTH 32
#define WEAPONS_SLOTS_MAX 5

enum WeaponsSlot
{
    Slot_Invalid        = -1,   /** Invalid weapon (slot). */
    Slot_Primary        = 0,    /** Primary weapon slot. */
    Slot_Secondary      = 1,    /** Secondary weapon slot. */
    Slot_Melee          = 2,    /** Melee (knife) weapon slot. */
    Slot_Projectile     = 3,    /** Projectile (grenades, flashbangs, etc) weapon slot. */
    Slot_Explosive      = 4,    /** Explosive (c4) weapon slot. */
    Slot_NVGs	      = 5,	/** NVGs (fake) equipment slot. */
};
public void OnPluginStart()
{
	RegConsoleCmd("sm_test",TestCMD);
}
public Action TestCMD(int client,int args)
{
	bool hasWeapon = WeaponsClientHasWeapon(client,"weapon_healthshot");
	if(hasWeapon)
	{
		PrintToChatAll("Has healthshot");
	}
}
stock bool WeaponsClientHasWeapon(int client, const char weapon[32])
{
    // Get all of client's current weapons.
    int weapons[WeaponsSlot];
    WeaponsGetClientWeapons(client, weapons);
    
    char classname[64];
    
    // x = slot index
    for (int x = 0; x < WEAPONS_SLOTS_MAX; x++)
    {
        // If slot is empty, then stop.
        if (weapons[x] == -1)
        {
            continue;
        }
        
        // If the weapon's classname matches, then return true.
        GetEdictClassname(weapons[x], classname, sizeof(classname));
        if (StrEqual(weapon, classname, false))
        {
            return true;
        }
    }   
    return false;
}
stock void WeaponsGetClientWeapons(int client, int weapons[WeaponsSlot])
{
    // x = Weapon slot.
    for (int x = 0; x < WEAPONS_SLOTS_MAX; x++)
    {
        weapons[x] = GetPlayerWeaponSlot(client, x);
    }
}

Last edited by ShD3luxe; 08-22-2019 at 08:22. Reason: Edited example
ShD3luxe is offline
JoaoRodrigoGamer
Junior Member
Join Date: Jul 2019
Location: Portugal
Old 08-22-2019 , 07:43   Re: [CSGO] Fetch client's weapons, grenades, etc...
Reply With Quote #5

Quote:
Originally Posted by ShD3luxe View Post
Here , I modified the code with the new syntax.
Code:
#include <sourcemod>
#include <sdktools>

#pragma newdecls required 
#define WEAPONS_MAX_LENGTH 32
#define WEAPONS_SLOTS_MAX 5

enum WeaponsSlot
{
    Slot_Invalid        = -1,   /** Invalid weapon (slot). */
    Slot_Primary        = 0,    /** Primary weapon slot. */
    Slot_Secondary      = 1,    /** Secondary weapon slot. */
    Slot_Melee          = 2,    /** Melee (knife) weapon slot. */
    Slot_Projectile     = 3,    /** Projectile (grenades, flashbangs, etc) weapon slot. */
    Slot_Explosive      = 4,    /** Explosive (c4) weapon slot. */
};
public void OnPluginStart()
{
	RegConsoleCmd("sm_test",TestCMD);
}
public Action TestCMD(int client,int args)
{
	bool hasWeapon = WeaponsClientHasWeapon(client,"weapon_healthshot");
	if(hasWeapon)
	{
		PrintToChatAll("Has healthshot");
	}
}
stock bool WeaponsClientHasWeapon(int client, const char weapon[32])
{
    // Get all of client's current weapons.
    int weapons[WeaponsSlot];
    WeaponsGetClientWeapons(client, weapons);
    
    char classname[64];
    
    // x = slot index
    for (int x = 0; x < WEAPONS_SLOTS_MAX; x++)
    {
        // If slot is empty, then stop.
        if (weapons[x] == -1)
        {
            continue;
        }
        
        // If the weapon's classname matches, then return true.
        GetEdictClassname(weapons[x], classname, sizeof(classname));
        ReplaceString(classname, sizeof(classname), "weapon_", "");
        if (StrEqual(weapon, classname, false))
        {
            return true;
        }
    }   
    return false;
}
stock void WeaponsGetClientWeapons(int client, int weapons[WeaponsSlot])
{
    // x = Weapon slot.
    for (int x = 0; x < WEAPONS_SLOTS_MAX; x++)
    {
        weapons[x] = GetPlayerWeaponSlot(client, x);
    }
}
It compiled with no errors, but when I check if the player has a health shot, it returns true.

PHP Code:
if(!WeaponsClientHasWeapon(client"weapon_healthshot"))
{
    
GivePlayerItem(client"weapon_healthshot");

Any idea to why it is still giving the health shot when the player already has one?
JoaoRodrigoGamer is offline
ShD3luxe
Member
Join Date: Aug 2019
Location: Localhost
Old 08-22-2019 , 08:06   Re: [CSGO] Fetch client's weapons, grenades, etc...
Reply With Quote #6

Try checking for another weapon and use a print message to see what is the output.
Code:
if(!WeaponsClientHasWeapon(client, "weapon_deagle")) 
{ 
    PrintToChat(client,"[DEBUG] You don't have a deagle");
}else{
   PrintToChat(client,"[DEBUG] You have a deagle");
}
ShD3luxe is offline
JoaoRodrigoGamer
Junior Member
Join Date: Jul 2019
Location: Portugal
Old 08-22-2019 , 08:11   Re: [CSGO] Fetch client's weapons, grenades, etc...
Reply With Quote #7

Quote:
Originally Posted by ShD3luxe View Post
Try checking for another weapon and use a print message to see what is the output.
Code:
if(!WeaponsClientHasWeapon(client, "weapon_deagle")) 
{ 
    PrintToChat(client,"[DEBUG] You don't have a deagle");
}else{
   PrintToChat(client,"[DEBUG] You have a deagle");
}
It always returns that I do not have a dealge. Even when I've got one from the round before.
JoaoRodrigoGamer is offline
ShD3luxe
Member
Join Date: Aug 2019
Location: Localhost
Old 08-22-2019 , 08:17   Re: [CSGO] Fetch client's weapons, grenades, etc...
Reply With Quote #8

Try putting a debug message in the WeaponsClientHasWeapons
Code:
stock bool WeaponsClientHasWeapon(int client, const char weapon[32])
{
    // Get all of client's current weapons.
    int weapons[WeaponsSlot];
    WeaponsGetClientWeapons(client, weapons);
    
    char classname[64];
    
    // x = slot index
    for (int x = 0; x < WEAPONS_SLOTS_MAX; x++)
    {
        // If slot is empty, then stop.
        if (weapons[x] == -1)
        {
            continue;
        }
        
        // If the weapon's classname matches, then return true.
        GetEdictClassname(weapons[x], classname, sizeof(classname));
        ReplaceString(classname, sizeof(classname), "weapon_", "");
        PrintToChat(client,"[DEBUG] User weapon %s , weapon to check for : %s",classname,weapon);
        if (StrEqual(weapon, classname, false))
        {
            return true;
        }
    }   
    return false;
}
Also try if(!WeaponsClientHasWeapon(client, "deagle")) instead of weapon_
This part ReplaceString(classname, sizeof(classname), "weapon_", ""); actually replaces the weapon_ in the player weapons and u don't need that when u call the function. You can delete that line and just use weapon_deagle or whatever u want to check.My bad I didn't saw that.

Last edited by ShD3luxe; 08-22-2019 at 08:20.
ShD3luxe is offline
JoaoRodrigoGamer
Junior Member
Join Date: Jul 2019
Location: Portugal
Old 08-22-2019 , 08:56   Re: [CSGO] Fetch client's weapons, grenades, etc...
Reply With Quote #9

Quote:
Originally Posted by ShD3luxe View Post
Try putting a debug message in the WeaponsClientHasWeapons
Code:
stock bool WeaponsClientHasWeapon(int client, const char weapon[32])
{
    // Get all of client's current weapons.
    int weapons[WeaponsSlot];
    WeaponsGetClientWeapons(client, weapons);
    
    char classname[64];
    
    // x = slot index
    for (int x = 0; x < WEAPONS_SLOTS_MAX; x++)
    {
        // If slot is empty, then stop.
        if (weapons[x] == -1)
        {
            continue;
        }
        
        // If the weapon's classname matches, then return true.
        GetEdictClassname(weapons[x], classname, sizeof(classname));
        ReplaceString(classname, sizeof(classname), "weapon_", "");
        PrintToChat(client,"[DEBUG] User weapon %s , weapon to check for : %s",classname,weapon);
        if (StrEqual(weapon, classname, false))
        {
            return true;
        }
    }   
    return false;
}
Also try if(!WeaponsClientHasWeapon(client, "deagle")) instead of weapon_
This part ReplaceString(classname, sizeof(classname), "weapon_", ""); actually replaces the weapon_ in the player weapons and u don't need that when u call the function. You can delete that line and just use weapon_deagle or whatever u want to check.My bad I didn't saw that.
So, I changed stock bool WeaponsClientHasWeapon(int client, const char weapon[32]) to
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_", "");
        
if (StrEqual(weaponclassnamefalse))
        {
            
PrintToConsole(client"%s :true"weapon);
            return 
true;
        }else{
               
PrintToConsole(client"%s :flase"weapon);
          }
    }  
    return 
false;

And I am still checking for the weapon like this:
PHP Code:
if(!WeaponsClientHasWeapon(client,"weapon_healthshot"))
{
    
GivePlayerItem(client"weapon_healthshot");

As I'm using PrintToConsole(), this is the debug I get:
Code:
weapon_healthshot :flase
weapon_healthshot :flase
weapon_healthshot :flase
weapon_tagrenade :flase
weapon_tagrenade :flase
weapon_tagrenade :true
weapon_hegrenade :flase
weapon_hegrenade :flase
weapon_hegrenade :flase
weapon_flashbang :flase
weapon_flashbang :flase
weapon_flashbang :flase
weapon_smokegrenade :flase
weapon_smokegrenade :flase
weapon_smokegrenade :flase
weapon_taser :flase
weapon_taser :flase
weapon_taser :flase
This means, that it is only identifying the tactical grenade...

(for the other debug tests you asked me to perform, the chat log is in the chat.txt file)

BTW, before going any further, I'm checking for the items in OnPlayerSpawn that is hooked to the player_spawn event and I'm placing the code blocks like this:

PHP Code:
public void OnPluginStart() //function where I hook the events

stock bool WeaponsClientHasWeapon(int client, const char weapon[32])

stock void WeaponsGetClientWeapons(int clientint weapons[WeaponsSlot])

public 
void OnPlayerSpawn(Handle event, const char[] namebool dontBroadcast
Can it be a problem be due to where the OnPlayerSpawn() is placed?
Attached Files
File Type: txt chat.txt (2.6 KB, 46 views)
JoaoRodrigoGamer is offline
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
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:07.


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