AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Hooking weapon remove (https://forums.alliedmods.net/showthread.php?t=141322)

NiHiLaNTh 10-22-2010 13:33

Hooking weapon remove
 
How to hook when some specified weapon( i.e. galil ) is removed from players inventory, in this case I need when player drops weapon ? I tried to use Ham_Item_Kill, but it seems that it isnt called in this situation. :?

Arkshine 10-22-2010 13:44

Re: Hooking weapon remove
 
Drop by command ? death ?

NiHiLaNTh 10-22-2010 13:50

Re: Hooking weapon remove
 
Quote:

Originally Posted by Arkshine (Post 1331778)
Drop by command ? death ?

Drop by command.

Arkshine 10-22-2010 13:51

Re: Hooking weapon remove
 
Simply hook "drop"

ARES[ro] 10-24-2010 18:10

Re: Hooking weapon remove
 
Quote:

Originally Posted by Arkshine (Post 1331784)
Simply hook "drop"

Yes, but if u want it to be more powerful and more hard to make use orpheu :D

Exolent[jNr] 10-24-2010 18:11

Re: Hooking weapon remove
 
Quote:

Originally Posted by ARES[ro] (Post 1333357)
Yes, but if u want it to be more powerful and more hard to make use orpheu :D

Umm, no. Just because it uses Orpheu doesn't make it better.
It makes it uselessly inefficient because hooking "drop" is all that is needed.

ARES[ro] 10-24-2010 18:17

Re: Hooking weapon remove
 
Quote:

Originally Posted by Exolent[jNr] (Post 1333359)
Umm, no. Just because it uses Orpheu doesn't make it better.
It makes it uselessly inefficient because hooking "drop" is all that is needed.

Yes indeed i was just being off topic its Arkshines fav module :D

Arkshine 10-24-2010 18:22

Re: Hooking weapon remove
 
Well, for sure, it would be more complicated, because "drop" command calls CBasePlayer:: DropPlayerItem() but this function is used in severals others functions, so using orpheu you would need either to filter the functions, either to hook ClientCommand() and filter the arguments. At the end, hooking "drop" is the simplest way and fits perfectly to the need here. ;)

ARES[ro] 10-24-2010 18:34

Re: Hooking weapon remove
 
Quote:

Originally Posted by Arkshine (Post 1333370)
Well, for sure, it would be more complicated, because "drop" command calls CBasePlayer:: DropPlayerItem() but this function is used in severals others functions, so using orpheu you would need either to filter the functions, either to hook ClientCommand() and filter the arguments. At the end, hooking "drop" is the simplest way and fits perfectly to the need here. ;)

Yes of course, i couldnt agree more (i actly never disagreed) but it would be more safe IMO to hook using either Ham_RemovePlayerItem or Ham_Item_Drop . The reason why i stated that is in case there is an other plugin that uses method to drop players weapons other than client_cmd(id, "drop") maybe calling ham or something.

Arkshine 10-24-2010 19:42

Re: Hooking weapon remove
 
If a plugin blocks the "drop" command using PLUGIN_HANDLED (instead of PLUGIN_MAIN_HANDLED), it means it's the plugin which is badly coded and that's not my fault. :p . Well, if you are crazy, you could still hook directly amxx with orpheu. ;)


All times are GMT -4. The time now is 19:55.

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