1. Hello,
    I was wondering if someone could help me with abit of trouble that I have come across.

    I have tried to modify a plugin (CompassGUI , Created by paiN) to show the player's current economy balance.
    I am not too sure how I tell the plugin to get the data from economy and display the player's current balance.

    I looked at the economy script and how it displayed the player's balance when the command /balance was entered. But the plugin that I am modifying is using C# not .lua

    I entered this return ("$(" + playerMoney[1] + ") ", API.GetUserDataFromPlayer(player));
    into the String GetPlayerBalance but oxide keeps returning an error
    Code:
    7:32 PM [Info] Unloaded plugin PlayerBalanceGUI v0.1.0 by PaiN/Ownage427
    7:32 PM [Error] Unable to load PlayerBalanceGUI. PlayerBalanceGUI.cs(20,9): error CS0246: The type or namespace name `plugin' could not be found. Are you missing an assembly reference?
    &
    7:33 PM [Error] PlayerBalanceGUI plugin failed to compile!
    7:33 PM [Error] PlayerBalanceGUI.cs(20,9): error CS0246: The type or namespace name `plugin' could not be found. Are you missing an assembly reference?
    Can someone please help me understand how to make this plugin work?

    Cheers,
    Mark
     

    Attached Files:

    Last edited by a moderator: Jul 21, 2015
  2. Calytic

    Calytic Community Admin Community Mod

    Taken from one of my personal plugins..

    Code:
    private Core.Configuration.DynamicConfigFile Economy;
    in Loaded..
    Code:
    this.Economy = Interface.GetMod().DataFileSystem.GetDatafile("Economics");
    In your method to get credits..
    Code:
    object econ = null;
                    if (this.Economy != null)
                    {
                        econ = this.Economy[playerID];
                        if (econ is List<object>)
                        {
                            List<object> econData = econ as List<object>;                        credits = Convert.ToSingle(econData[0].ToString());
                        }
                    }
     
  3. The economy api is made for Lua.
    I will convert economy to .cs soon, so you will have normal api)
     
  4. Thanks Calytic for the code that you have submitted!
    I have a idea of what I need to do now,
    but I will wait for Bombardir to update the plugin to c#
    Cheers guys,
    Mark