Getting info out of other plugin?Solved
Let's say for example (a VERY crude example) that this is the original plugin:

using UnityEngine;
using System.Collections.Generic;
using Oxide.Core.Plugins;
using Oxide.Core;

namespace Oxide.Plugins
{
    [Info("Test", "Me", 0.1)]
    [Description("Test")]

    class Test : RustPlugin
    {
        void OnEntitySpawned(BaseNetworkable entity)
        {
            if (entity.name.Contains("bear"))
            {
                PrintToChat("A bear has spawned at: " + entity.transform.position);
            }

        }
    }
}​


And I want to get this info out of this plugin using another plugin... how would I do that? Thank you. :)
Hey!
Info? What info?
In response to misticos ():
Hey!
Info? What info?
Let's say I want to replace that entity.transform.position with a position of my own from my plugin... feeding my own coordinate to that plugin from my plugin and getting back the answer
Hello,

You have to create "hook" from your plugin
using UnityEngine;
using System.Collections.Generic;

namespace Oxide.Plugins
{
    [Info("Test", "Me", 0.1)]
    [Description("Test")]
    class Test : RustPlugin
    {
        private Dictionary<BaseNetworkable, Vector3> listEntity = new Dictionary<BaseNetworkable, Vector3>();

        void OnEntitySpawned(BaseNetworkable entity)
        {
            //Getting default position
            var pos = entity.transform.position;
            //Changing position by adding 20 to everything
            pos.x += 20;
            pos.y += 20;
            pos.z += 20;

            //Saving informations to a dictionary
            listEntity.Add(entity, pos);


            if (entity.name.Contains("bear"))
            {
                PrintToChat("A bear has spawned at: " + entity.transform.position);
            }
        }

        //Create hook "GetEntityPosition" can be called by Test.Call("GetEntityPosition", entity); from your other plugin
        private Vector3 GetEntityPosition(BaseNetworkable entity)
        {
            //Checking if entity isn't destroyed
            if (entity.IsDestroyed) return Vector3.zero;
            //Checking if entity is spawned
            if (!entity.isSpawned) return Vector3.zero;

            //Checking if dictionary contains the entity and display saved position if it contain it
            if(listEntity.ContainsKey(entity))
                return listEntity[entity];
            return Vector3.zero;
        }
    }
}​
Thanks Sami. :)
Locked automatically