Raised This Month: $32 Target: $400
 8% 

Solved Calling a function from or passing its value to other plugins


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
PatriotGames
AlliedModders Donor
Join Date: Feb 2012
Location: root@irs:/# rm -rf /
Old 01-13-2019 , 18:13   Calling a function from or passing its value to other plugins
Reply With Quote #1

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

Last edited by PatriotGames; 01-14-2019 at 18:34. Reason: solved
PatriotGames is offline
Spirit_12
Veteran Member
Join Date: Dec 2012
Location: Toronto, CA
Old 01-13-2019 , 18:38   Re: Calling a function from or passing its value to other plugins
Reply With Quote #2

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?
__________________
Spirit_12 is offline
PatriotGames
AlliedModders Donor
Join Date: Feb 2012
Location: root@irs:/# rm -rf /
Old 01-13-2019 , 19:01   Re: Calling a function from or passing its value to other plugins
Reply With Quote #3

Quote:
Originally Posted by Spirit_12 View Post
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
PatriotGames is offline
Spirit_12
Veteran Member
Join Date: Dec 2012
Location: Toronto, CA
Old 01-13-2019 , 20:18   Re: Calling a function from or passing its value to other plugins
Reply With Quote #4

Forward is definitely the way to go then!
__________________
Spirit_12 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 15:33.


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