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

[REQ] Function request - callfunc_push_array()


  
 
 
Thread Tools Display Modes
Author Message
Zenith77
Veteran Member
Join Date: Aug 2005
Old 08-07-2006 , 21:58   [REQ] Function request - callfunc_push_array()
#1

Basicly, it would be nice to have callfunc_push_array().
Yes I know, that this is out-dated with ExecuteForward and CreateForward and they exist now, but those won't work with the way my plugin works.
Thank you.

--Zenith
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
Twilight Suzuka
bad
Join Date: Jul 2004
Location: CS lab
Old 08-07-2006 , 23:32   Re: [REQ] Function request - callfunc_push_array()
#2

I never really got why that wasn't in there...
__________________
Twilight Suzuka is offline
Send a message via AIM to Twilight Suzuka Send a message via MSN to Twilight Suzuka
Zenith77
Veteran Member
Join Date: Aug 2005
Old 08-08-2006 , 00:05   Re: [REQ] Function request - callfunc_push_array()
#3

Me to. Why have a callfunc_push_str() function but not a callfunc_push_array() :/.
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
BAILOPAN
Join Date: Jan 2004
Old 08-08-2006 , 01:40   Re: [REQ] Function request - callfunc_push_array()
#4

I don't know whether I want to add this or not as I view the callfunc set of natives to be deprecated (as they can be nicely replaced by register_native and CreateOneForward).

I'm marking it for unsupported addition for now, I'll reply to this thread when there's a commit to the source tree.
__________________
egg
BAILOPAN is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 08-08-2006 , 11:01   Re: [REQ] Function request - callfunc_push_array()
#5

Quote:
Yes I know, that this is out-dated with ExecuteForward and CreateForward and they exist now, but those won't work with the way my plugin works.
:/

My plugin needs needs to be able to dynamically pass parameters to a function. Ok this is how it works (I won't past code since its a private plugin)....

My plugin is using the sockets. Ok when data is received, it is sorted out into arguments, then, the plugin will look at how some other plugin wants this data to be called to its function and then convert the parameters from a string to what the data type needs to be.

Summary:

Plugin receives a "message".
Looks through it's message table and finds the base plugin that registered the message.
Sorts out the arguments.
Loops through all the arguments and checks from the forward data type table what data type each argument should be, and converts it (str_to_num, str_to_float, etc).

The last step when the plugin loops through all the arguments is why I need the callfunc_push_array(), because of the plugin's protocal. If any of the DEV's need to look at the code, I'll PM it to them.
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred

Last edited by Zenith77; 08-08-2006 at 11:03.
Zenith77 is offline
Greenberet
AMX Mod X Beta Tester
Join Date: Apr 2004
Location: Vienna
Old 08-08-2006 , 11:50   Re: [REQ] Function request - callfunc_push_array()
#6

Quote:
Originally Posted by Zenith77
:/

My plugin needs needs to be able to dynamically pass parameters to a function. Ok this is how it works (I won't past code since its a private plugin)....

My plugin is using the sockets. Ok when data is received, it is sorted out into arguments, then, the plugin will look at how some other plugin wants this data to be called to its function and then convert the parameters from a string to what the data type needs to be.

Summary:

Plugin receives a "message".
Looks through it's message table and finds the base plugin that registered the message.
Sorts out the arguments.
Loops through all the arguments and checks from the forward data type table what data type each argument should be, and converts it (str_to_num, str_to_float, etc).

The last step when the plugin loops through all the arguments is why I need the callfunc_push_array(), because of the plugin's protocal. If any of the DEV's need to look at the code, I'll PM it to them.
I wrote a plugin that could be very similar to yours.
It lets you execute public functions from any plugin
Callfunc implementation
Greenberet is offline
Send a message via ICQ to Greenberet Send a message via MSN to Greenberet
Zenith77
Veteran Member
Join Date: Aug 2005
Old 08-08-2006 , 12:31   Re: [REQ] Function request - callfunc_push_array()
#7

Your's is actually very close to how mine works, but it still doesn't solve my problem :/.
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
Greenberet
AMX Mod X Beta Tester
Join Date: Apr 2004
Location: Vienna
Old 08-08-2006 , 15:14   Re: [REQ] Function request - callfunc_push_array()
#8

And i have a solution with dynamic natives for you
Code:
#include <amxmodx> native callfunc_push_array( arr[] ); public plugin_natives() {     register_native( "callfunc_push_array", "__callfunc_push_array" ); } public __callfunc_push_array( ) {     return callfunc_push_int( get_param( 1 ) ); } public plugin_init () {     register_plugin( "Push Array", "1.0", "Greenberet" );     register_clcmd( "push_array", "cmdPushArray" ); } public arrayprint( arr[], len ) {     static string[512]     formatex( string, 512, "%i", arr[0] );     for( new i = 1; i < len; i++ )         format( string,512, "%s %i", string,arr[i] );             client_print(0, print_chat, "Array: %s | Len: %i", string, len ); } public cmdPushArray( Client ) {     new bla[6];         for( new i = 0; i < 6; i++ )         bla[i] = 5 - i;         client_print( 0, print_chat, "direct call" );     arrayprint( bla, 6 );         client_print( 0, print_chat, "callfunc call" );         callfunc_begin_i( get_func_id("arrayprint") );     callfunc_push_array( bla );     callfunc_push_int( 6 );     callfunc_end(); }

output:
Code:
direct call
5 4 3 2 1 0
callfunc call
5 4 3 2 1 0
Greenberet is offline
Send a message via ICQ to Greenberet Send a message via MSN to Greenberet
Zenith77
Veteran Member
Join Date: Aug 2005
Old 08-08-2006 , 15:56   Re: [REQ] Function request - callfunc_push_array()
#9

Wow, thanks.

I actually though about doing that, since aww nm screw it. Thanks again. +karama

-Zenith
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
Greenberet
AMX Mod X Beta Tester
Join Date: Apr 2004
Location: Vienna
Old 08-08-2006 , 16:38   Re: [REQ] Function request - callfunc_push_array()
#10

Here is a patch file for the current svn revision to add this native
Attached Files
File Type: rar callfunc_push_array.rar (283 Bytes, 152 views)
Greenberet is offline
Send a message via ICQ to Greenberet Send a message via MSN to Greenberet
 


Thread Tools
Display Modes

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 05:40.


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