AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved Custom Function (https://forums.alliedmods.net/showthread.php?t=335757)

ConorCC 01-01-2022 07:23

Custom Function
 
Hy there!

Can I create native functions that accept function names as parameters?

Like this...
PHP Code:

register_touch("func_wall""player" "OnPlayerWallTouch"); 

PHP Code:

public OnPlayerWallTouch(const iEntityId, const iId) {} 

Where "OnPlayerWallTouch" is a function's name.

My Case:

The Sub Plugin call this native function.
PHP Code:

RegisterSomething("Anything"1337"MyFunction"); 

The Main Plugins stores this data. Any whenever something happen this will trigger all the functions are registered with "RegisterSomething". In this case "MyFunction" will be called inside of the sub plugin.

Like forwards just not exactly. If something happen in main they notice the sub plugins are subscribed with this function.

Is it cleaner? Thank you!

Edit:

I think I found the solution. I was looking for "callfunc_begin" and "callfunc_end". The only think I have to store the plugin and the function's name.

fysiks 01-01-2022 17:22

Re: Custom Function
 
It sounds like maybe MultiFowards would be something that you should consider using instead.

ConorCC 01-02-2022 06:41

Re: Custom Function
 
I was looking for something that call a function in one plugin only. This can be done with "callfunc_" BUT the link in your post just helped me to realize there is an another option to avoid this. "CreateOneForward" that I haven't seen this in plugins so I didn't even know this exists.

So Thank you again, this will be much better I think!


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

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