plugin-to-plugin communication
to what extent can plugins communicate with one another?
|
xvars, cvars, vault, files, sql, tasks, ...
But to be honest; why do you need interplugin communication? I have made a lot of plugins and almost never really needed that. |
I can see that .. I'm thinking of redoing next map.. and map chooser so they track the last 5 maps.. I would like to share vars between them.
|
you can also call a public function in an another plugin using the callfunc_* natives. Check the amxmodx.inc file for details
|
hmm
Quote:
Quote:
when |
hmm lol the function prototype actually is
Code:
anyways, here is an example: Code:
this will call the public function my_function in the plugin theplugin.amx, the first parameter will be 4, the second parameter will be "Hello", the third parameter will be the value of myfloatvalue variable / constant / whatever. In returnValue, the return value will be stored ;] callfunc_push_int: push the value of the integer used with normal parameters callfunc_push_intrf: push the reference to the variable used with &prm parameters callfunc_push_float: push the value of the float used with Float:prm parameters callfunc_push_floatrf: push the reference to the float variable used with &Float:prm parameters callfunc_push_str: push a string (an array) used with prm[] / const prm[] parameters A native like callfunc(func, plugin, param1, param2, param2); is not possible / very very hard to implement. |
Is there anything bad, to use a couple of cvars for communication? Especially slow, limited, etc...?
|
Hrm
What does it mean to "push"?
|
snd info over to that plugin
|
push and pop refer to stacks of data such as an array or list.
Push adds an item to the tail/end of a list. PM's callfunc works by pushing values onto a list of parameters and then calling the actual function once you end it. much like message_begin ... write_x.... message_end |
Hrm...
What kinda things is this usefull for?
|
if you have to ask you don't know ;]
<serious> it's useful for calling arbitrary functions that you do not know the name for. for example, PHP has this ability: $x = "myfunction" $x(); //This will call "myfunction" if it exists same thing in C: int myfunc(void); int (*func)(void) = myfunc; (*func)(); |
?
Does the "callfunc_begin" execute the public fuction in the plugin also?
|
Re: ?
Quote:
|
oh
yeah sorry PM.. thats what i meant but when You execute it it will run what evers in that public command?
|
i don't really understand you so i'll make an example :)
plugin1 Code:
plugin2 Code:
The output should be: Code:
Will call the_function in plugin1.amx; the int param is 4, the intrf Param is 8, the str param is "(:" |
| All times are GMT -4. The time now is 21:35. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.