1. OpenFunRus

    OpenFunRus Scavenger Plugin Developer

    Hi.

    I began to study the scripts . I can not find the information how to make a console command . I need to issue a "Ban".

    My script simple anticheat:
    Code (C#):
    using System;
    using System.Collections.Generic;
    using System.Linq;
    namespace Oxide.Plugins
    {
        [Info("АнтиЧит", "OpenFun", 0.1)]
        [Description("Makes epic stuff happen")]

        class AntiCheat : SevenDaysPlugin
        {
            void OnPlayerConnected(EntityPlayer player)
            {
                int p = 40;
                float detectX = 0;
                float detectY = 0;
                float detectZ = 0;
                float e = 0;
                float w = 0;
                float n = 0;
                float s = 0;
                int wrn = 0;
                var anticheat = true;
                timer.Repeat(3, 0, () =>
                {
                    if (!anticheat)
                    {
                        anticheat = true;
                        detectX = player.position.x;
                        detectY = player.position.y;
                        detectZ = player.position.z;
                        if (e == 0)
                        {
                            e = player.position.x + p;
                            w = player.position.x - p;
                            n = player.position.z + p;
                            s = player.position.z - p;
                        }
                            if (e < detectX || w > detectX || n < detectZ || s > detectZ)
                        {
                            wrn = wrn + 1;
                            e = player.position.x + p;
                            w = player.position.x - p;
                            n = player.position.z + p;
                            s = player.position.z - p;
                            PrintWarning($"Внимание! Игрок " + player.EntityName + " получил предупреждение " + wrn);
                            PrintWarning($"Позиция игрока: x=" + player.position.x + " z=" + player.position.z);
                        }
                            else
                        {
                            e = player.position.x + p;
                            w = player.position.x - p;
                            n = player.position.z + p;
                            s = player.position.z - p;
                            if (wrn > 0)
                            {
                            wrn = wrn - 1;
                            }
                        }
                        if (wrn == 5)
                        {
                            sdtd.BroadcastChat("Anticheat", "" + player.EntityName + " Читер");
                            PrintWarning($"Читер " + player.EntityName + " " + player.position);
                            wrn = 0;
                        }
                        return;
                    }
                    if (anticheat)
                    {
                        anticheat = false;
                        return;
                    }
                });
            }              
        }
    }
     
    Last edited by a moderator: Apr 9, 2016
  2. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    Which console are you thinking of?
     
  3. OpenFunRus

    OpenFunRus Scavenger Plugin Developer

    Console in 7 days to die. I want to add command. example: if (playerID=cheater) { SdtdConsoleWrite("Ban playerID reason");}


    analogue commands: sdtd.BroadcastChat("");
     
  4. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    So the server console and/or log? Print, PrintWarning, and PrintError should all log to the console and log file.
     
  5. OpenFunRus

    OpenFunRus Scavenger Plugin Developer

    No. I wont ban player (not log), how I cant the ban player in script? And 7 days to die have another console, if I print warning in oxide console, it not show in 7 days console. Need send in 7 days console "ban playerName reason" or another metod...
     
  6. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    So you want to send a console command, not a message. I don't think there is anything setup for that yet with Oxide, but you can dig around in the game's Assembly-CSharp.dll to see how it handles command sending and banning.
     
  7. OpenFunRus

    OpenFunRus Scavenger Plugin Developer

    How I can use "ConsoleCmdAbstract" in my script? it is in the file Assembly-CSharp.dll
     
  8. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    I don't know how to send console commands with it, so you'd know just as much as me right now. I'll try to do some digging once I get a chance.
     
  9. DeeJayh

    DeeJayh Naked Wanderer

    Does Oxide hook into the Assembly-CSharp.dll in such a way that we could even utilize something like ConsoleCmdAbstract? Or would we have to wait for you, the Oxide developers, to actually create a hook specifically for it?
     
    OpenFunRus likes this.
  10. OpenFunRus

    OpenFunRus Scavenger Plugin Developer

    Oxide API for 7 Days to Die - it is wrong metod, and MISINFORMS the developer

    Code (Text):
    void OnRunCommand(ClientInfo client, String[] args)
    {
        Puts("OnRunCommand works!");
    }
    NEED:
    Code (Text):
            void OnRunCommand(ClientInfo _cInfo, string _cmd)
                {
                    Puts("OnRunCommand works!");
                }
     
    Last edited by a moderator: Apr 10, 2016
  11. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    It's actually not wrong, you can have multiple arguments, you just aren't accessing them right. If you have only a single argument, then just string is fine. This is the same as with every other game Oxide supports.

    Oxide for 7 Days to Die doesn't have as much available yet as other games we support do, I don't think anyone has added all of the command handling yet.
     
  12. DeeJayh

    DeeJayh Naked Wanderer

    And why that's true, is completely beyond me... 7DTD, as a game, has surpassed every game you develop Oxide for, I even dare say Rust... Granted playability has always been a bit of an issue, but the content is certainly there, BEGGING to be modified and made just that much better by the community, that since the recent major revision, has gained a nice increase... Keep in mind I'm being very subjective here, I am a huge Rust fanboy from way back and I still consider the above an accurate statement.
     
  13. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    It takes developers interested in it too, and it hasn't been expressed as much here. A single contributor cannot do it all instantly.
     
  14. DeeJayh

    DeeJayh Naked Wanderer

    That's kind of a fallacy... I guarantee you plenty of people have popped on here getting excited to use/create some mods for 7DTD, see that there are no plugins, and no discussion, and walk away to other solutions.
     
  15. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    I was referring to myself and others that contribute to the core as well as plugin developers. It takes more than just plugins to support it for a game. If a game has the support, more is put into it. Right now there is mainly myself and one other developer that contributes to the core and game support actively across the 8 games we support. The game developers started their own modding API back after we started as well, which sort of put this on the backburner.

    I still plan to add more for 7 Days to Die, but it isn't as much of a priority as the other games that have a higher userbase and demand in our community. My time is also split between getting all games other than Rust to have the same amount of hooks or more and trying to work on other aspects of the project such as the web portions (the current focus).
     
  16. DeeJayh

    DeeJayh Naked Wanderer

    Are you accepting help, or is that because you didn't let anyone else in on the project? Is Oxide as a whole Open-Source?
     
  17. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    The entire project is open-source and available via GitHub (links on each download page), the instructions have been there for anyone to PR to if they'd like to contribute. We have a few other that contribute every so often, but mainly just me and another team member right now.
     
  18. DeeJayh

    DeeJayh Naked Wanderer

    Awesome, that's the answer I was hoping for.
     
  19. OpenFunRus

    OpenFunRus Scavenger Plugin Developer

    Console Ban code:

    SdtdConsole.Instance.ExecuteSync(string.Format("Ban add {0} 10 years \"{1}\"", _cInfo.playerName, "This reason"), _cInfo);
     
  20. DeeJayh

    DeeJayh Naked Wanderer

    Awesome! Thank you so much! Now I should be able to turn that into pretty much any command I'd like to utilize. Thank you friend!