Raised This Month: $ Target: $400
 0% 

Get variable value from variable in other plugin?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sandurr
Senior Member
Join Date: Aug 2005
Old 04-13-2006 , 17:53   Get variable value from variable in other plugin?
Reply With Quote #1

Like so:

Plugin 1 has a variable x = 1

I want Plugin 2

To get value of x and be able to store it in another variable?

Thanks
Sandurr is offline
SweatyBanana
BANNED
Join Date: Sep 2005
Location: LOL
Old 04-13-2006 , 17:55  
Reply With Quote #2

If you save it as a cvar, then yes you could do that...
SweatyBanana is offline
Send a message via AIM to SweatyBanana Send a message via Yahoo to SweatyBanana
Sandurr
Senior Member
Join Date: Aug 2005
Old 04-13-2006 , 17:57  
Reply With Quote #3

Any other ways
Sandurr is offline
GHW_Chronic
SourceMod Donor
Join Date: Sep 2004
Location: Texas
Old 04-13-2006 , 18:00  
Reply With Quote #4

1. make it a public varaible, not just a global variable.
2. make a native in the plugin that the other plugin can call to check the status of the variable.
GHW_Chronic is offline
Send a message via AIM to GHW_Chronic
SweatyBanana
BANNED
Join Date: Sep 2005
Location: LOL
Old 04-13-2006 , 18:05  
Reply With Quote #5

or save it into a vault
SweatyBanana is offline
Send a message via AIM to SweatyBanana Send a message via Yahoo to SweatyBanana
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 04-13-2006 , 18:12  
Reply With Quote #6

or implement a public query function in Plugin1 and use callfunc natives to call it from Plugin2.
__________________
hello, i am pm
PM is offline
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 04-13-2006 , 18:14  
Reply With Quote #7

Quote:
Originally Posted by PM
or implement a public query function in Plugin1 and use callfunc natives to call it from Plugin2.
Thats what GHW_Chronic said but in a different way.
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 04-13-2006 , 18:40  
Reply With Quote #8

Quote:
Originally Posted by Suicid3
Quote:
Originally Posted by PM
or implement a public query function in Plugin1 and use callfunc natives to call it from Plugin2.
Thats what GHW_Chronic said but in a different way.
No, GHW_Chronic suggested using the register_native system.

Basically, when you register a native, any plugin can call it without knowing the "target plugin". ie. simply by the native name.

With callfunc you have to provide the target plugin.
__________________
hello, i am pm
PM 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 05:09.


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