Raised This Month: $ Target: $400
 0% 

Q:How to run commands from one plugin out of another plugin?


Post New Thread Reply   
 
Thread Tools Display Modes
Johnny got his gun
Veteran Member
Join Date: Jan 2004
Location: Tokyo
Old 04-18-2004 , 17:01  
Reply With Quote #11

If you want to run functions residing in other plugins:

Code:
/* 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);
Johnny got his gun is offline
IceMouse[WrG]
Senior Member
Join Date: Mar 2004
Old 04-18-2004 , 17:50  
Reply With Quote #12

It would be nice to note that (I'm pretty sure) you must push the values BEFORE calling the function
IceMouse[WrG] is offline
Send a message via AIM to IceMouse[WrG] Send a message via MSN to IceMouse[WrG] Send a message via Yahoo to IceMouse[WrG]
AssKicR
Veteran Member
Join Date: Mar 2004
Location: Norway-Europe(GTM+1)
Old 04-18-2004 , 18:42  
Reply With Quote #13

Jonny u forgot

Code:
/* Make the actual call. * Return value of the function called. */ native callfunc_end();
__________________
My Plugins

Got ??
AssKicR is offline
IceMouse[WrG]
Senior Member
Join Date: Mar 2004
Old 04-18-2004 , 18:58  
Reply With Quote #14

Alright.. Then you push the vars inbetween callfunc_begin() and callfunc_end()
IceMouse[WrG] is offline
Send a message via AIM to IceMouse[WrG] Send a message via MSN to IceMouse[WrG] Send a message via Yahoo to IceMouse[WrG]
RedBaron
Junior Member
Join Date: Apr 2004
Old 04-18-2004 , 20:39  
Reply With Quote #15

Okay guys,

so, how would the code look like with

bbmonster_spawn agrunt RedBaron

green = plugincommand
blue = monstername
red = playername

but the monster- and playername should be variable!?!?!?

P.S.: If someone wants to see how the "advanced" AntiCampingplugin works, just give me a PM!!!
RedBaron is offline
IceMouse[WrG]
Senior Member
Join Date: Mar 2004
Old 04-18-2004 , 20:45  
Reply With Quote #16

Well since Zor is so picky:
Code:
new playername[33]; get_user_name(id,playername,32); new monstername[33]; switch(random_num(1,2)) {     case 1: strcpy(monstername,"agrunt",33);     case 2: strcpy(monstername,"hassassin",33); } server_cmd("bbmonster_spawn %s %s",monstername,playername);
(Don't rely on those being correct functions)
IceMouse[WrG] is offline
Send a message via AIM to IceMouse[WrG] Send a message via MSN to IceMouse[WrG] Send a message via Yahoo to IceMouse[WrG]
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 11:36.


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