Raised This Month: $ Target: $400
 0% 

Questions about callfunc_begin_i


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 02-06-2013 , 17:15   Questions about callfunc_begin_i
Reply With Quote #1

I read from Connor that the second parameter is the value returned from the register_plugin native.

So my question is:

When I create a native in one plugin. And I call that native from another one the parameters to the native handler in the main plugin that created the native are iPlugin and iParams. Is the iPlugin the plugin ID that can be used in the Callfun_begin_i native?

Example is below. I typed this out in notepad without highlighting so If i have typos sorry but you should be able to understand the basics of what i need

Spoiler


To explain in text:
  1. I create a native and send the class name and function call back.
  2. I add that class string name to an array.
  3. I add the plugin id and function id to a temp array.
  4. I add the temparray to a trie using the class name as a key.
  5. I delete the temparray. (or try to anyway)
  1. Option selected from menu (not in example thats the easy part)
  2. Use selection to send player index and selection index to the callfunction function
  3. select the classname from the array using the selection index
  4. grab the temp array from the trie using the class name
  5. call the function in the temp array slot 1 in the plugin slot 0
Doc-Holiday is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-07-2013 , 00:55   Re: Questions about callfunc_begin_i
Reply With Quote #2

What is that shit ?
Seem that you are making your life difficult and you could do what you need with simplest code, question is what are you trying to do ?

But answer is yes, plugin ID is unique, returned by register_plugin, get_plugin, and passed to style 0 natives handlers.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 02-07-2013 , 07:41   Re: Re: Questions about callfunc_begin_i
Reply With Quote #3

Quote:
Originally Posted by ConnorMcLeod View Post
What is that shit ?
Seem that you are making your life difficult and you could do what you need with simplest code, question is what are you trying to do ?

But answer is yes, plugin ID is unique, returned by register_plugin, get_plugin, and passed to style 0 natives handlers.
Basically. I want to store a plugin id a function id from a child plugin.
Instead of the tries I could of just used a second array.

But one array holds the class index and class name. The other needs to have the plugin id and function id in which to call for the child plugin. That way instead of calling a global forward it is only valuing the specific function for what ever class was chosen
Doc-Holiday is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-07-2013 , 13:18   Re: Questions about callfunc_begin_i
Reply With Quote #4

Send single forwards to plugins instead of having to call a native for each arg you want to push..
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 02-07-2013 , 13:25   Re: Re: Questions about callfunc_begin_i
Reply With Quote #5

Quote:
Originally Posted by ConnorMcLeod View Post
Send single forwards to plugins instead of having to call a native for each arg you want to push..
I don't under stand what your saying. It is for a modular system such as super hero mod. The naive simply registers it for a menu and stores the plugin id and function id for when the class is selected

The only arg getting pushed is client id from the main plugin

Last edited by Doc-Holiday; 02-07-2013 at 13:26.
Doc-Holiday is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-07-2013 , 19:22   Re: Questions about callfunc_begin_i
Reply With Quote #6

I say that instead of :

PHP Code:
    callfunc_begin_i(ArrayGetCell(temparray1), ArrayGetCell(temparray0));
    
callfunc_push_int(id);
    
callfunc_end() 

You could send a single forward, so only to the wanted plugin.

PHP Code:
ExecuteForward(forward_indexreturn_valueid

forward created this way :

PHP Code:
forward_index CreateOneForward(plugin_indexcallback[], FP_CELL
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 02-07-2013 at 19:23.
ConnorMcLeod is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 02-08-2013 , 02:50   Re: Re: Questions about callfunc_begin_i
Reply With Quote #7

Quote:
Originally Posted by ConnorMcLeod View Post
I say that instead of :

PHP Code:
    callfunc_begin_i(ArrayGetCell(temparray1), ArrayGetCell(temparray0));
    
callfunc_push_int(id);
    
callfunc_end() 

You could send a single forward, so only to the wanted plugin.

PHP Code:
ExecuteForward(forward_indexreturn_valueid

forward created this way :

PHP Code:
forward_index CreateOneForward(plugin_indexcallback[], FP_CELL
How do I make one for every plugin that registers a class. I would need some array of forward handles. I guess I can Institute a Max number of classes
Doc-Holiday is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 02-08-2013 , 02:52   Re: Re: Questions about callfunc_begin_i
Reply With Quote #8

Quote:
Originally Posted by Doc-Holiday View Post
How do I make one for every plugin that registers a class. I would need some array of forward handles. I guess I can Institute a Max number of classes
New g_iForwards[MAXCLASSES];
then use the index that I get when the class registers. I'll play around with it Thanks. I'll post back once I get s compiled and tested
Doc-Holiday is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-08-2013 , 11:20   Re: Questions about callfunc_begin_i
Reply With Quote #9

You can see examples of single forwards in ATAC 3 plugin.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 02-08-2013 , 12:43   Re: Re: Questions about callfunc_begin_i
Reply With Quote #10

Quote:
Originally Posted by ConnorMcLeod View Post
You can see examples of single forwards in ATAC 3 plugin.
Thanks I will take a look
Doc-Holiday 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 20:29.


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