Raised This Month: $ Target: $400
 0% 

function-call from other plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mogel
Senior Member
Join Date: Jan 2007
Old 03-18-2007 , 04:00   function-call from other plugin
Reply With Quote #1

Hi,

is it possible to call a function from an other plugin?

Code:
plugin1.amxx
public foo()
{
    server_print("foo()")
}
Code:
plugin2.amxx
public bar()
{
    foo()
}
hand, mogel
__________________

Last edited by mogel; 03-18-2007 at 04:03.
mogel is offline
Toster v2.1
Senior Member
Join Date: Oct 2006
Location: Latvia, Riga
Old 03-18-2007 , 05:12   Re: function-call from other plugin
Reply With Quote #2

I think this would work:

Code:
1.Plugin
 
#include <amxmodx>
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "Ya name"
 
public plugin_init() 
{
 register_plugin(PLUGIN, VERSION, AUTHOR)
 register_cvar("foo","0")
 set_task(0.1,"fooit",1,"",1,"b")
}
public fooit()
{
 if(get_cvar_num("foo")==1)
  {
    server_print("foo")
    server_cmd("foo 0")
  }
}

Code:
2.Plugin
 
server_cmd("foo 1")
__________________
I am 52% addicted to Counterstrike. What about you?

Last edited by Toster v2.1; 03-18-2007 at 05:19.
Toster v2.1 is offline
Send a message via Skype™ to Toster v2.1
P34nut
AMX Mod X Beta Tester
Join Date: Feb 2006
Location: Netherlands
Old 03-18-2007 , 05:37   Re: function-call from other plugin
Reply With Quote #3

Code:
callfunc_begin("foo", "myplugin.amxx") //Now you can use callfunc_push_int() to push an integer to it // Look: <a href="http://www.amxmodx.org/funcwiki.php?search=callfunc&go=search" target="_blank" rel="nofollow noopener">http://www.amxmodx.org/funcwiki.php?...func&go=search</a> callfunc_end()
__________________
All you need to change the world is one good lie and a river of blood
P34nut 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 10:42.


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