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

How to get player's current weapon model


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sekac
Senior Member
Join Date: Nov 2016
Old 06-18-2018 , 09:36   How to get player's current weapon model
Reply With Quote #1

I want to know how to get the model of a weapon that a player is currently holding. I don't need a weapon name, just model, since I want it to work with custom weapons too.
sekac is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 06-18-2018 , 10:28   Re: How to get player's current weapon model
Reply With Quote #2

PHP Code:
new szWeapon[128]
pev(idpev_viewmodel2szWeaponcharsmax(szWeapon)) 
__________________

Last edited by OciXCrom; 06-18-2018 at 10:28.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
sekac
Senior Member
Join Date: Nov 2016
Old 06-18-2018 , 11:28   Re: How to get player's current weapon model
Reply With Quote #3

Thank you.

Is it possible to count how many P_MODELS a player has active at once? Since I am displaying multiple P_MODELS on a player but I don't know how to get that number.
sekac is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 06-18-2018 , 11:45   Re: How to get player's current weapon model
Reply With Quote #4

Quote:
Originally Posted by sekac View Post
Thank you.

Is it possible to count how many P_MODELS a player has active at once? Since I am displaying multiple P_MODELS on a player but I don't know how to get that number.
How are you exactly displaying multiple p models?
__________________
HamletEagle is offline
sekac
Senior Member
Join Date: Nov 2016
Old 06-18-2018 , 12:05   Re: How to get player's current weapon model
Reply With Quote #5

Well I didn't write the plugin so I don't know. But I can see bots holding two overlayed weapons and I can hide each of them separately, so I figured it's possible. The second weapon is the same as the player's current weapon (same P_MODEL) so that might be how.
sekac is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 06-18-2018 , 13:09   Re: How to get player's current weapon model
Reply With Quote #6

I don't think having more than one model active at the same time is possible.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
sekac
Senior Member
Join Date: Nov 2016
Old 06-18-2018 , 13:26   Re: How to get player's current weapon model
Reply With Quote #7

Quote:
Originally Posted by OciXCrom View Post
I don't think having more than one model active at the same time is possible.
I will open a thread about this, it's a bug in a plugin that I need fixed.

Edit: https://forums.alliedmods.net/showthread.php?p=2597761

Last edited by sekac; 06-18-2018 at 13:35.
sekac 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 00:35.


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