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

Event when user gets a new weapon


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ghostdlr
Senior Member
Join Date: Aug 2010
Old 12-03-2022 , 07:04   Event when user gets a new weapon
Reply With Quote #1

How can I detect when a user bought a new weapon or picked it up from the ground?

Basically I want to get what weapons the user is carrying in real time and get notified when they change, preferably with some event handler. (Game is Counter-Strike)

Last edited by ghostdlr; 12-03-2022 at 07:08.
ghostdlr is offline
Old 12-03-2022, 07:36
kww
This message has been deleted by kww. Reason: unnecessary
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 12-04-2022 , 00:44   Re: Event when user gets a new weapon
Reply With Quote #2

You can try Ham_AddPlayerItem. This thread has some examples: https://forums.alliedmods.net/showthread.php?t=85632

To get all of his weapons, you can use pev( id , pev_weapons ), which will give you all of their weapons in a bitfield of the CSW_ weapon ID's.
__________________

Last edited by Bugsy; 12-04-2022 at 00:57.
Bugsy is online now
ghostdlr
Senior Member
Join Date: Aug 2010
Old 12-06-2022 , 11:29   Re: Event when user gets a new weapon
Reply With Quote #3

Quote:
Originally Posted by Bugsy View Post
You can try Ham_AddPlayerItem. This thread has some examples: https://forums.alliedmods.net/showthread.php?t=85632

To get all of his weapons, you can use pev( id , pev_weapons ), which will give you all of their weapons in a bitfield of the CSW_ weapon ID's.
pev doesn't work

WARNING [356]: expression has no effect
WARNING [356]: expression has no effect
ERROR [356]: undefined symbol "pev"
ERROR [356]: expected token: ";", but found ")"
ERROR [356]: invalid expression, assumed zero
ghostdlr is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 12-06-2022 , 12:50   Re: Event when user gets a new weapon
Reply With Quote #4

Add fakemeta

new iWeaponBits = pev( id , pev_weapons );
__________________
Bugsy is online now
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 12-09-2022 , 09:07   Re: Event when user gets a new weapon
Reply With Quote #5

Another way you can try is the WeapPickup event
__________________
Bugsy is online now
ghostdlr
Senior Member
Join Date: Aug 2010
Old 12-13-2022 , 11:08   Re: Event when user gets a new weapon
Reply With Quote #6

I added fakemeta and all worked perfectly after. Thanks.

Last edited by ghostdlr; 12-13-2022 at 11:08.
ghostdlr 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 06:42.


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