Get the gun owner
Hello guys.
When a player picks up a fallen weapon, is it possible to know who was the player who bought it? And who dropped it? |
Re: Get the gun owner
Ham_Touch (weaponbox) or Ham_Item_AddToPlayer (dropped weapons) and Ham_Item_Drop (when weapon is dropped).
|
Re: Get the gun owner
What I wanted was this.
When a player picks up a fallen weapon, a message will appear saying, "You got the gun from the 'Name of person who bought it' ". |
Re: Get the gun owner
You can get only the last owner of the weapon (weaponbox owner).
|
Re: Get the gun owner
Or maybe he can manually keep the owners for every weapon entity?!?
|
Re: Get the gun owner
RegisterHam(Ham_CS_Item_CanDrop, "weapon_name", "Ham_Item_Can_Drop", 0)
new owner = fm_get_weapon_owner(ent) //player who dropped the weapon set_pev(entity, pev_iuser2, owner) Pev iuser 2 is not used by weapons and you save owners ID there. Then use ham item deploy with the same way but instead you get owner ID from pev. public ham_deploy(entity) new owner = pev(entity, pev_iuser2) //next do what you need with owner If you want to save the very first owner who bought the weapon then before saving pev iuser, check if pev user2 is null so that you don't overwrite the original owner with the player who picks up and then drops that weapon. Like : if(pev(entity, pev_iuser2) == 0) set_pev(entity, pev_iuser2, owner) This way you check if dropped weapon didn't have owner before which means that current owner bought this weapon. If you have difficulties with that, I will give u the code tomorrow (on phone creepy to write :)) |
Re: Get the gun owner
Thank you for your help!
I'll try tomorrow. |
Re: Get the gun owner
PHP Code:
|
Re: Get the gun owner
Quote:
|
Re: Get the gun owner
Quote:
|
All times are GMT -4. The time now is 00:43. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.