AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Get variable value from variable in other plugin? (https://forums.alliedmods.net/showthread.php?t=27038)

Sandurr 04-13-2006 17:53

Get variable value from variable in other plugin?
 
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

SweatyBanana 04-13-2006 17:55

If you save it as a cvar, then yes you could do that...

Sandurr 04-13-2006 17:57

Any other ways

GHW_Chronic 04-13-2006 18:00

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.

SweatyBanana 04-13-2006 18:05

or save it into a vault :)

PM 04-13-2006 18:12

or implement a public query function in Plugin1 and use callfunc natives to call it from Plugin2.

Xanimos 04-13-2006 18:14

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.

PM 04-13-2006 18:40

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.


All times are GMT -4. The time now is 05:09.

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