Raised This Month: $ Target: $400
 0% 

CreateOneForward or callfunc_begin & callfunc_end


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 04-18-2013 , 17:12   CreateOneForward or callfunc_begin & callfunc_end
Reply With Quote #1

Hello,

What should i use if i need to call function inside of one plugin
Functions will be called < 100 times sec
also < 100 times call in one sec will be called function with one param max or no params at all.

I like callfunc_begin because it is so nice and easy to add params
PHP Code:
native callfunc_push_int(value);
native callfunc_push_float(Floatvalue);
native callfunc_push_intrf(&value);
native callfunc_push_floatrf(& Floatvalue);
native callfunc_push_str(const VALUE[], bool:copyback=true);
native callfunc_push_array(const VALUE[], array_sizebool:copyback=true); 
but in CreateOneForward native
when you create forward you will also set param count and types in same time.
I also heard that callfunc_begin is bad and i should use createforward native but in my case it is little bit bad.

Im trying to do my own forwards system what will run inside my plugin and also have my taste in opportunities.
PHP Code:
// First i create my forward point or something... like this
new g_myforward
func
()
{
    
g_myforward fn_register()
}

// now i register callback for it 
// i can add unlimited callbacks for one forward point, they all get called when i call my forward in func3()
new g_myforwardcallback
func2
()
{
    
g_myforwardcallback fn_addg_myforward"myfn_callback"  )
    
// g_myforwardcallback is needed for removing that callback later if i need to remove it

}

// now lets call my forward
func3()
{
    
fn_param//  this is how i add int or float values
    
fn_param2"hello" // and this is string
    
fn_callg_myforward )

}

// now callback
public myfn_callbackintvaluestring[] )
{


I really need some feedback..
Thanks!

Last edited by .Dare Devil.; 04-18-2013 at 17:13.
.Dare Devil. is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-19-2013 , 01:41   Re: CreateOneForward or callfunc_begin & callfunc_end
Reply With Quote #2

Basically, callfunc was the old system, before you were able to create forwards and dynamic natives.
You can still use when you want to support a plugin that is not yours and you want people can use your plugin and the other plugin, but if it if for your own usage, i suggest to edit the plugin that is not yours so you can add forward or dynamic native in it.

single forward, multi forward, dynamic native, depends on your needs, and not harder to use than callfunc ;)
__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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:52.


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