Calling Functions from other plugins
Right this is a simple enough question, but its the first time ive done it and i cant get it to work :/
OK, what i want to do is call a function in one plugin from another plugin. In this instance i want to modify my ATAC plugin to send a message to my IRC plugin. So in my IRC plugin ive added this code: Code:
And in my ATAC plugin ive added this: Code:
Now, when this function should be called by the ATAC plugin it doesnt work. When i try to force it to work by typing the 'amx_ircmsg_kick' command by hand i get these errors: Quote:
Damo. |
Use the callfunc mechanism to call functions from one plugin in an another one. Check out the funcwiki or do a forum search :)
|
Sorry PM, had a look now :D
The reason i asked was because i know that Yomama did something like this with his amx_bans plugin and the ATAC plugin: Quote:
|
No its a bad way.
Use either callfunc_being() or callfunc_begin_i() Code:
The function you calling in NameOfPlugin.amxx needs to be public btw :) |
kk ty ;)
only problem with learning from other peoples code is you pick up bad habits and learn incorrect work arounds :D |
OK, Ive tried using callfunc and i cant seem to get it to work, heres what ive got..
Code:
That (should) execute the 'inform_kick' function in ircbot.amxx. Note that ive put in the case for my own bug checking at the moment to see if it prints any output....i get nothing at the moment, although i know the code must be getting called because 'CLIENT ABOUT TO BE KICKED!' is displayed. It must be something to do with the above because its not priting any of the return values after it should have executed the function :( Heres the code for the 'inform_kick' function Code:
Anyone got any suggestions, something else i should be doing ?? Thanks Damo. |
Post the beginning line of the function your trying to look at
|
You check inform_kick for a return value, but it doesn't have one...
callfunc_begin returns the following: 1 - Success 0 - Runtime error (=never) -1 - Plugin not found -2 - Function not found callfunc_end returns the return value passed from the function called. Therefore you are checking if inform_kick returned 1, or 2, or 3, etcetera, because you catch the value from callfunc_end, but it doesn't return anything. |
victim[] should be victim
|
Why? He's sending a string.
|
| All times are GMT -4. The time now is 19:26. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.