AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to... (https://forums.alliedmods.net/showthread.php?t=55499)

B1ondu 05-23-2007 09:26

How to...
 
How to get an array from other plugin ?

like:

Plugin1: Array[id] = 1

Plugin2: if(Array[id] !=0){
//something
}

regalis 05-23-2007 15:42

Re: How to...
 
As nobody have an idea:
I would prolly make it over nvault or a text-file...
Safe the array from one plugin and read it by an other...
But be aware of race conditions! I don't know exactly how to prevent that.
I know this idea is hackish, but better than no solution!?

greetz regalis

pRED* 05-23-2007 16:57

Re: How to...
 
You can't read variables from another plugin.

You can however transfer data from one plugin to another. Read Hawks tutorial on "Plugin API" in the tutorials section.

Cheap_Suit 05-23-2007 20:10

Re: How to...
 
Here is one way you can do this:

plugin #1:

PHP Code:

public plugin_natives() 
{
 
register_native("plugin_array_one""native_plugin_array_one")
}
public 
native_plugin_array_one(pluginparams)
{
 if(
params != 1)
  return 
0
 
     
new id get_param(1)
     if(!
id) return 0
      
return array[id]



plugin #2:

PHP Code:

native plugin_array_one(id)
public 
plugin_init() 
{
 
register_plugin(PLUGINVERSIONAUTHOR)
}
public 
my_function(id)
{
 new 
value plugin_array_one(id)



Zenith77 05-23-2007 22:16

Re: How to...
 
(I think)You can also declare a variable as public, fully exposing it to the VM, and allowing other plugins to access it by name. If not cheap suit's way will be the only way.

I think War3 did this or something. Check there and the pawn manual of course :).


All times are GMT -4. The time now is 10:34.

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