AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Weapon "donation" (https://forums.alliedmods.net/showthread.php?t=206045)

Backstabnoob 01-17-2013 17:23

Weapon "donation"
 
I'm trying to think of a way this could be done. By donation, I simply mean when a player drops their weapon and another one picks it up (from the same team).

I thought about hooking weapon pickup, checking the weapon's owner and compare teams with the player picking the weapon.

I cannot find a proper hook for this though - I'm sure hooking WeapPickUp event would be too late, as the weapon's owner would already be overwritten. Ham with pre hook could work, but I've had problems with Ham_AddPlayerItem and I cannot see any other Ham hook for this.

Thanks in advance.

Edit: I need the index of the donator.

AngeIII 01-17-2013 17:26

Re: Weapon "donation"
 
client cmd -> drop
called before user drop weapon entity.

Backstabnoob 01-17-2013 17:34

Re: Weapon "donation"
 
what


learn something new every day

AngeIII 01-17-2013 18:41

Re: Weapon "donation"
 
just check war3ft plugin, that hook what weapon dropped, and who drop them. after that you can hook weapon pickup with the same way, and check...

ConnorMcLeod 01-18-2013 00:53

Re: Weapon "donation"
 
You can save weapon owner when weapon is added into weaponbox (BOOL CWeaponBox::PackWeapon( CBasePlayerItem *pWeapon )) but you can only hook this function with rage or orpheu.
During this function, weapon's owner is changed from player to weaponbox, you could use some pev->euserX to store previous owner.

About weaponbox Touch, you can retrieve weapons indexes with pdata.

Needed pdatas here : http://forums.alliedmods.net/showthr...01#post1712101
When you have retrieved 'weapon', just check pev(weapon, pev_euser1) for example, don't forget to check if touching player is able to pickup that weapon first.
Spoiler


All times are GMT -4. The time now is 13:39.

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