AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Solved Calling a function from or passing its value to other plugins (https://forums.alliedmods.net/showthread.php?t=313571)

PatriotGames 01-13-2019 18:13

Calling a function from or passing its value to other plugins
 
Say that I have a plugin with a function that counts i every x seconds. Now, if I want to adjust cvars in other plugins based on the i++ value, what is the best method to call that count function or pass its value to those other plugins? I read the wiki section on forwards and it seems that method could be used here, though I've not used one before and am not sure how to set it up.

OTOH, would it be equally effective to simply include the count function and its timer in the other plugins and create the timers from the same event hook? Would the timers stay synchronized and does it matter? :?


Thank you,
PG

Spirit_12 01-13-2019 18:38

Re: Calling a function from or passing its value to other plugins
 
I would personally use the forwards method. It is much more streamlined than recreating the whole function. With that being said it also depends on the function. Would you be using this function in multiple plugins or just one?

PatriotGames 01-13-2019 19:01

Re: Calling a function from or passing its value to other plugins
 
Quote:

Originally Posted by Spirit_12 (Post 2634626)
I would personally use the forwards method. It is much more streamlined than recreating the whole function. With that being said it also depends on the function. Would you be using this function in multiple plugins or just one?

That's the impression I got from the wiki. The count function will be used in at least three other plugins.

PG

Spirit_12 01-13-2019 20:18

Re: Calling a function from or passing its value to other plugins
 
Forward is definitely the way to go then!


All times are GMT -4. The time now is 07:41.

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