AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Event when user gets a new weapon (https://forums.alliedmods.net/showthread.php?t=340685)

ghostdlr 12-03-2022 07:04

Event when user gets a new weapon
 
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)

Bugsy 12-04-2022 00:44

Re: Event when user gets a new weapon
 
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.

ghostdlr 12-06-2022 11:29

Re: Event when user gets a new weapon
 
Quote:

Originally Posted by Bugsy (Post 2794338)
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

Bugsy 12-06-2022 12:50

Re: Event when user gets a new weapon
 
Add fakemeta

new iWeaponBits = pev( id , pev_weapons );

Bugsy 12-09-2022 09:07

Re: Event when user gets a new weapon
 
Another way you can try is the WeapPickup event

ghostdlr 12-13-2022 11:08

Re: Event when user gets a new weapon
 
I added fakemeta and all worked perfectly after. Thanks.


All times are GMT -4. The time now is 21:41.

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