1. Hi, i just started my adventure in making plugins like 1 hour ago. And I'm facing a wierd warning in my IDE. The code was working ok, until i started writing the IFs to check for some things. Now I'm getting an error which can't actually translate to english... it's something like:
    Code:
    "The type 'FacepunchBehaviour' is defined in an assembly that is not referenced. You must add a reference to the assembly 'Facepunch.UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
    - WARNING: This translation might be just product of my imagination. -
    Well that error only occurs when placing the IFs, so I don't really get it.
    Code:
    void OnEntityDeath(BaseCombatEntity victim, HitInfo info)
            {
                if(victim != null)
                {
                    if (victim is BasePlayer)
                    {
                       
                    }
                }
            }
     
  2. Wulf

    Wulf Community Admin

    You're missing a reference to Facepunch.UnityEngine as the warning suggests.
     
  3. I don't really know how to solve it lol, is it like an include? i dont really get why this type of error pops when doing that IF, when the code inside it didnt :/
     
  4. Wulf

    Wulf Community Admin

    Google: "add dll reference to visual studio" - or whatever IDE you use.
     
  5. yeah ok, i did that with all DLLs in the managed folder. question is, why is the IDE asking me for that only when writting the IFs? there's nothing in those IFs i didn't use already in the code inside them, and the code inside the IFs worked perfectly, i already tested it in a server. So it makes no sense at all to me.
    This doesnt work:
    Code:
    void OnEntityDeath(BaseCombatEntity victim, HitInfo info)
            {
                if(victim != null)
                {
                    if (victim is BasePlayer)
                    {
                        var Online = BasePlayer.activePlayerList as System.Collections.Generic.List<BasePlayer>;
                        BasePlayer randomPlayer = Online[JugadorAleatorio(Online.Count)];
                        string saltyMessage = "seriously " + GetVictimsName(victim) + ", you're a fucking noob, kill yourself";
                        Puts("El nombre de jugador aleatorio es: " + randomPlayer.displayName);
                        Puts("El SaltyMessage es: " + saltyMessage);
                        Server.Broadcast(saltyMessage, "<color=#54A7FB>" + randomPlayer.displayName + "</color>", GetSaltyPlayerID(randomPlayer));
                    }
                }
            }
    This works perfectly:
    Code:
    void OnEntityDeath(BaseCombatEntity victim, HitInfo info)
            {
                        var Online = BasePlayer.activePlayerList as System.Collections.Generic.List<BasePlayer>;
                        BasePlayer randomPlayer = Online[JugadorAleatorio(Online.Count)];
                        string saltyMessage = "seriously " + GetVictimsName(victim) + ", you're a fucking noob, kill yourself";
                        Puts("El nombre de jugador aleatorio es: " + randomPlayer.displayName);
                        Puts("El SaltyMessage es: " + saltyMessage);
                        Server.Broadcast(saltyMessage, "<color=#54A7FB>" + randomPlayer.displayName + "</color>", GetSaltyPlayerID(randomPlayer));
            }
    i'm like.... WTF!?!
    and where do i get that DLL from? and if it's not included in Oxide, how's the plugin going to work? i really dont get it.
     
  6. Wulf

    Wulf Community Admin

    Something you are referencing is looking for that type, which sounds like it is in that DLL, so makes sense to me.
     
  7. well, it works anyway with the warning now that i tested it. how can i check if the BaseCombatEntity is a scientist?

    ok, with the NPCAPEXPlayer thing
     
    Last edited by a moderator: Jun 14, 2018