Raised This Month: $32 Target: $400
 8% 

Weapon Detect


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
InteX01
Senior Member
Join Date: Jan 2017
Old 01-14-2018 , 16:01   Weapon Detect
Reply With Quote #1

Is it possible to get_user_weapon, when its not in his hands..
Like. Player is holding knife, but he is having weapon..
If i hit him, the message should popup in chat.
WEAPON DETECTED or something if he has it.

EDIT: Yeh, except c4, knife, grenades

Last edited by InteX01; 01-14-2018 at 16:13.
InteX01 is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 01-14-2018 , 16:14   Re: Weapon Detect
Reply With Quote #2

Aren't you aware of user_has_weapon native?
__________________
edon1337 is offline
InteX01
Senior Member
Join Date: Jan 2017
Old 01-14-2018 , 16:19   Re: Weapon Detect
Reply With Quote #3

Never used, and never needed till now
Thanks, I searched and searched, but searched for a wrong thing.. Thanks, im gonna test this now...
Just....
I could use is like this ?
user_has_weapon(id, CSW_M3 || CSW_KNIFE || ....) ?
InteX01 is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 01-14-2018 , 17:56   Re: Weapon Detect
Reply With Quote #4

PHP Code:
user_has_weaponidCSW_* ) 
__________________
edon1337 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-14-2018 , 19:00   Re: Weapon Detect
Reply With Quote #5

Quote:
Originally Posted by InteX01 View Post
Never used, and never needed till now
Thanks, I searched and searched, but searched for a wrong thing.. Thanks, im gonna test this now...
Just....
I could use is like this ?
user_has_weapon(id, CSW_M3 || CSW_KNIFE || ....) ?
You can only check 1 weapon with that native. If you need to check multiple with a single call, you can use pev_weapons (fakemeta) using a bit-wise OR for each weapon.
PHP Code:
new iWeapons pevid pev_weapons );
    
const 
Knife = ( << CSW_KNIFE );
const 
AK47 = ( << CSW_AK47 );
    
if ( ( 
iWeapons & ( Knife AK47 ) ) == ( Knife AK47 ) )
{
    
//Has knife and AK47.

__________________
Bugsy is offline
Rohanlogs
Senior Member
Join Date: Nov 2015
Old 01-14-2018 , 21:58   Re: Weapon Detect
Reply With Quote #6

Quote:
Originally Posted by InteX01 View Post
Is it possible to get_user_weapon, when its not in his hands..
Like. Player is holding knife, but he is having weapon..
If i hit him, the message should popup in chat.
WEAPON DETECTED or something if he has it.

EDIT: Yeh, except c4, knife, grenades
So..
You want to print a chat message when you hit an enemy that tells which weapons they have?
But not for c4, knife and grenades?
__________________
Rohanlogs is offline
Reply


Thread Tools
Display Modes

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 21:29.


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