AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to hook event raised in another plugin (https://forums.alliedmods.net/showthread.php?t=83275)

redomin8 01-07-2009 00:06

How to hook event raised in another plugin
 
Is there any way to hook an event in another plugin? Say hooking zombieplague's buy_extra_item, that way we know everytime someone has bought something?

jim_yang 01-07-2009 00:28

Re: How to hook event raised in another plugin
 
edit that plugin, fire a forword using plugin api

danielkza 01-07-2009 00:44

Re: How to hook event raised in another plugin
 
Quote:

Originally Posted by jim_yang (Post 739695)
edit that plugin, fire a forword using plugin api

Considering ZP has forwards for lots of things, it's probably already implemented.

EDIT: Yes, here it is:
PHP Code:

/* Called when a player buys an extra item from the ZP menu
*  player - will hold the id of the player who's buying
*  itemid - will contain the internal extra item ID */
forward zp_extra_item_selected(playeritemid


redomin8 01-07-2009 01:06

Re: How to hook event raised in another plugin
 
Yes but unfortunately zp_extra_item_selected is only raised for any added custom items (all the default ones are handled internally)

i am making a plugin, and i didnt want every user that wants to try it to have to edit or replace their zombieplague amxxs as well
but thanks for your help guys, it looks like thats the only way

danielkza 01-07-2009 01:08

Re: How to hook event raised in another plugin
 
Quote:

Originally Posted by redomin8 (Post 739702)
Yes but unfortunately zp_extra_item_selected is only raised for any added custom items (all the default ones are handled internally)

i am making a plugin, and i didnt want every user that wants to try it to have to edit or replace their zombieplague amxxs as well
but thanks for your help guys, it looks like thats the only way

The best way is to ask Mercylezz to add the extra forward for you, then tell possible users that they need the lastest version. I'm pretty sure he'll help you.


All times are GMT -4. The time now is 09:07.

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