AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Questions about callfunc_begin_i (https://forums.alliedmods.net/showthread.php?t=207779)

Doc-Holiday 02-06-2013 17:15

Questions about callfunc_begin_i
 
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

ConnorMcLeod 02-07-2013 00:55

Re: Questions about callfunc_begin_i
 
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.

Doc-Holiday 02-07-2013 07:41

Re: Re: Questions about callfunc_begin_i
 
Quote:

Originally Posted by ConnorMcLeod (Post 1888914)
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

ConnorMcLeod 02-07-2013 13:18

Re: Questions about callfunc_begin_i
 
Send single forwards to plugins instead of having to call a native for each arg you want to push..

Doc-Holiday 02-07-2013 13:25

Re: Re: Questions about callfunc_begin_i
 
Quote:

Originally Posted by ConnorMcLeod (Post 1889331)
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

ConnorMcLeod 02-07-2013 19:22

Re: Questions about callfunc_begin_i
 
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


Doc-Holiday 02-08-2013 02:50

Re: Re: Questions about callfunc_begin_i
 
Quote:

Originally Posted by ConnorMcLeod (Post 1889666)
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 02-08-2013 02:52

Re: Re: Questions about callfunc_begin_i
 
Quote:

Originally Posted by Doc-Holiday (Post 1889896)
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

ConnorMcLeod 02-08-2013 11:20

Re: Questions about callfunc_begin_i
 
You can see examples of single forwards in ATAC 3 plugin.

Doc-Holiday 02-08-2013 12:43

Re: Re: Questions about callfunc_begin_i
 
Quote:

Originally Posted by ConnorMcLeod (Post 1890137)
You can see examples of single forwards in ATAC 3 plugin.

Thanks I will take a look


All times are GMT -4. The time now is 20:29.

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