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

Check if a Player has a revolver.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
good_live
AlliedModders Donor
Join Date: Oct 2013
Old 02-20-2016 , 13:46   Check if a Player has a revolver.
Reply With Quote #1

Hey guys,
is there a way to check if a player has a revolver?
GetClientWeapon gives me weapon_deagle, when the player has a revolver.
Greetings
good_live is offline
xines
Veteran Member
Join Date: Aug 2013
Location: Denmark
Old 02-20-2016 , 14:19   Re: Check if a Player has a revolver.
Reply With Quote #2

Something like this might work.

PHP Code:
    #include <sdktools>
    
    
new String:clsname[] = "weapon_revolver"
    new 
ent MaxClients+1

    while((
ent FindEntityByClassname(ent"weapon_*")) != -1)
    {
        if(
GetEntityClassname(entclsnamesizeof(clsname)))
        {
            if(!
StrEqual(clsname"weapon_revolver"))
            {
                if(
GetEntProp(entProp_Send"m_iState") == 2// This client is carrying this weapon and it's the currently held weapon
                
{
                    new 
client GetEntPropEnt(entProp_Send"m_hOwnerEntity"); // Get client

                    
                
}
    
                
AcceptEntityInput(ent"Kill");
            }
        }
    } 
__________________
xines is offline
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 02-20-2016 , 14:34   Re: Check if a Player has a revolver.
Reply With Quote #3

This works? Not tested....

PHP Code:
bool:HasPlayerRevolver(iClient)
{
    new 
iWeapon GetPlayerWeaponSlot(iClient1);
    return (
iWeapon == -1) ? false : (GetEntProp(iWeaponProp_Send"m_iItemDefinitionIndex") == 64);


https://tf2b.com/itemlist.php?gid=730
__________________
Plugins: TeamGames
Includes: Menu stocks, ColorVariables, DownloadTableConfig

> No help through PM, make a topic.

Last edited by KissLick; 02-20-2016 at 14:35.
KissLick is offline
good_live
AlliedModders Donor
Join Date: Oct 2013
Old 02-21-2016 , 03:35   Re: Check if a Player has a revolver.
Reply With Quote #4

Quote:
Originally Posted by KissLick View Post
This works? Not tested....

PHP Code:
bool:HasPlayerRevolver(iClient)
{
    new 
iWeapon GetPlayerWeaponSlot(iClient1);
    return (
iWeapon == -1) ? false : (GetEntProp(iWeaponProp_Send"m_iItemDefinitionIndex") == 64);


https://tf2b.com/itemlist.php?gid=730
That works fine. Thanks to all
good_live is offline
SM9
Veteran Member
Join Date: Sep 2013
Location: United Kingdom
Old 02-22-2016 , 12:55   Re: Check if a Player has a revolver.
Reply With Quote #5

PHP Code:
#include <csgoitems>

if(bPlayerHasWeapon(iClient"weapon_revolver")) {
    
// ezpz
}

stock bool bPlayerHasWeapon(int iClient, const char[] chWeapon)
{
    if(!
IsPlayerAlive(iClient)) {
        return 
false;
    }
    
    return 
CSGOItems_FindWeaponByClassName(iClientchWeapon) != -1;

https://bitbucket.org/SM91337/csgo-items/src

Last edited by SM9; 02-22-2016 at 13:09.
SM9 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 07:19.


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