Raised This Month: $51 Target: $400
 12% 

plugin-to-plugin communication


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ann0yanc3
Junior Member
Join Date: Mar 2004
Old 03-30-2004 , 01:18   plugin-to-plugin communication
Reply With Quote #1

to what extent can plugins communicate with one another?
ann0yanc3 is offline
Johnny got his gun
Veteran Member
Join Date: Jan 2004
Location: Tokyo
Old 03-30-2004 , 01:20  
Reply With Quote #2

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.
Johnny got his gun is offline
KiN | SuicideDog
Senior Member
Join Date: Mar 2004
Old 03-30-2004 , 03:23  
Reply With Quote #3

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.
__________________
Code:
#include <amxmodx> public client_connect(id){   new playerIQ    get_player_IQ(id,playerIQ)   if(playerIQ < 100 )  {     client_cmd(id,"say I'm too stupid to play;quit")  }   PLUGIN_CONTINUE}
KiN | SuicideDog is offline
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 03-30-2004 , 05:25  
Reply With Quote #4

you can also call a public function in an another plugin using the callfunc_* natives. Check the amxmodx.inc file for details
__________________
hello, i am pm
PM is offline
MagicShot
Senior Member
Join Date: Mar 2004
Location: MN
Old 03-30-2004 , 12:04   hmm
Reply With Quote #5

Quote:
Originally Posted by PM
you can also call a public function in an another plugin using the callfunc_* natives. Check the amxmodx.inc file for details
Quote:
/* Call a function in this / an another plugin by name.
* Parameters:
* plugin - plugin name; if "", the caller plugin is used.
* If specified, it has to be the exact name (for example stats.amx)
* func - function name
* Return value:
* 1 - Success
* 0 - Runtime error
* -1 - Plugin not found
* -2 - Function not found */
native callfunc_begin(const plugin[]="", const func[]);


/* Push a parameter (integer, string, float) */
native callfunc_push_int(value);
native callfunc_push_str(value[]);
native callfunc_push_float(Float: value);
native callfunc_push_intrf(&value);
native callfunc_push_floatrf(& Float: value);

/* Make the actual call.
* Return value of the function called. */
native callfunc_end();
Do all three of those need to be used when calling a pubic?

when
__________________
|v|agic$hot
.
Without a Sound
MagicShot is offline
Send a message via MSN to MagicShot Send a message via Yahoo to MagicShot
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 03-30-2004 , 12:20  
Reply With Quote #6

hmm lol the function prototype actually is
Code:
native callfunc_begin(const func[], const plugin[]="");
looks like we have messed it up in the include file

anyways, here is an example:
Code:
callfunc_begin("my_function", "theplugin.amx"); callfunc_push_int(4); callfunc_push_str("Hello"); callfunc_push_float(myfloatvalue); new returnValue = callfunc_end();

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.
__________________
hello, i am pm
PM is offline
]FUSION[ Gray Death
Member
Join Date: Mar 2004
Location: Hamburg / Germany
Old 03-30-2004 , 12:34  
Reply With Quote #7

Is there anything bad, to use a couple of cvars for communication? Especially slow, limited, etc...?
]FUSION[ Gray Death is offline
MagicShot
Senior Member
Join Date: Mar 2004
Location: MN
Old 03-30-2004 , 18:02   Hrm
Reply With Quote #8

What does it mean to "push"?
__________________
|v|agic$hot
.
Without a Sound
MagicShot is offline
Send a message via MSN to MagicShot Send a message via Yahoo to MagicShot
AssKicR
Veteran Member
Join Date: Mar 2004
Location: Norway-Europe(GTM+1)
Old 03-30-2004 , 18:05  
Reply With Quote #9

snd info over to that plugin
__________________
My Plugins

Got ??
AssKicR is offline
BAILOPAN
Join Date: Jan 2004
Old 03-30-2004 , 18:05  
Reply With Quote #10

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
__________________
egg
BAILOPAN is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 00:29.


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