Universal Site registration

Discussion in 'Plugin Requests' started by AMX PRO MESSI, Feb 2, 2016.

  1. Please update plugin from 1.18 to 2 version

    Thanks in advance.

    Code:
    function On_PlayerConnected(Player) {    var enable = Data.GetConfigValue("Register++", "Main", "enable");
            if (enable == "true") {
                var url = Data.GetConfigValue("Register++", "Main", "url");
                var online = Web.GET(""+url+"?steamid="+Player.SteamID+"&name="+Player.Name+"");
        }
    }function On_PlayerDisconnected(Player) {    var enable = Data.GetConfigValue("Register++", "Main", "enable");
            if (enable == "true") {
                var url = Data.GetConfigValue("Register++", "Main", "url");
                var online = Web.GET(""+url+"?steamid="+Player.SteamID+"&offline=0");    }
    }function On_Command(Player, cmd, args){
         if(cmd == "password"){
        var enable = Data.GetConfigValue("Register++", "Main", "enable");
            if (enable == "true") {
                var url = Data.GetConfigValue("Register++", "Main", "url");
                var pass = Web.GET(""+url+"?steamid="+Player.SteamID+"&pass="+args[0]+"");            if (pass == 1) {
                   
                    Player.Notice("㋛", "Ваш пароль успешно изменен!", 10);               }               else {                 Player.Notice("Извините, сервер авторизации временно недоступен.");                }        }
        }
    }
    
     
  2. Wulf

    Wulf Community Admin

    What exactly does the plugin do, and what exactly do you want it to do?
     
  3. I use the mod Extended, it removed support Magma oxide and 1.18, but added support oxide is 2.0.

    I need to work on this plugin oxide 2.0

    Thanks in advance.
     
  4. Wulf

    Wulf Community Admin

    Keep in mind that we only support official builds of Oxide, not third-party implementations of it. Is the plugin just for setting passwords for users, and if so, why is it needed when there is Steam authentication?
     
  5. Provide the full plugin?
     
  6. This plug-in integrates seamlessly with the site, people set passwords on the server and plug-in sends passwords to the site.
    [DOUBLEPOST=1454500812][/DOUBLEPOST]
    Plugin

    Code:
    function On_PlayerConnected(Player) {    var enable = Data.GetConfigValue("Register++", "Main", "enable");
            if (enable == "true") {
                var url = Data.GetConfigValue("Register++", "Main", "url");
                var online = Web.GET(""+url+"?steamid="+Player.SteamID+"&name="+Player.Name+"");
        }
    }function On_PlayerDisconnected(Player) {    var enable = Data.GetConfigValue("Register++", "Main", "enable");
            if (enable == "true") {
                var url = Data.GetConfigValue("Register++", "Main", "url");
                var online = Web.GET(""+url+"?steamid="+Player.SteamID+"&offline=0");    }
    }function On_Command(Player, cmd, args){
         if(cmd == "password"){
        var enable = Data.GetConfigValue("Register++", "Main", "enable");
            if (enable == "true") {
                var url = Data.GetConfigValue("Register++", "Main", "url");
                var pass = Web.GET(""+url+"?steamid="+Player.SteamID+"&pass="+args[0]+"");            if (pass == 1) {
                   
                    Player.Notice("㋛", "Ваш пароль успешно изменен!", 10);               }               else {                 Player.Notice("Извините, сервер авторизации временно недоступен.");                }        }
        }
    }
    
    Config

    Code:
    [Main]
    enable=true
    url=http://install.ru/reg.php
    
    [DOUBLEPOST=1454614559,1454500717][/DOUBLEPOST]People help.
    Make the plugin worked for Oxide 2.0
     
  7. Why you don't try to do it by yourself? Not so hard
    Code:
    webrequest.EnqueueGet("http://www.google.com/search?q=oxide", function(code, response)
    if response == nil or code ~= 200 then
    print("Couldn't get an answer from Google!")
    return
    end
    print("Google answered: " .. tostring(response))
    end, self.Plugin)
    
    Api is here Oxide API for Rust Legacy
     
  8. I can not do it myself, I do not know the programming language.
    Please, if you can help me with the plugin.
    Thank you.
     
  9. We haven't born with programming language in our brains either :)
     
  10. I am willing to pay for a plug-in to WebMoney or give itself CMS server
     
  11. Code:
    namespace Oxide.Pluginsusing System;
    using Oxide.Core;
    using Oxide.Core.Libraries;
    using System.Text;{
        [Info("SiteRegistration", "Prefix", 0.1)]
        [Description("Makes epic stuff happen")]    class SiteRegistration : RustLegacyPlugin
        {
          
            public static bool enabled = true;
            public static string url = "http://install.ru/reg.php";
            public static string success = "You have changed your password successfully";
            public static string failure = "Some problems occured with your server, try later.";
            public static string nname = "Registration";
          
            void LoadDefaultConfig() { }
            private void CheckCfg<T>(string Key, ref T var)
            {
                if (Config[Key] is T)
                    var = (T)Config[Key];
                else
                    Config[Key] = var;
            }
          
            void Init()
            {
                CheckCfg<bool>("Enabled", ref enabled);
                CheckCfg<string>("URL", ref url);
                CheckCfg<string>("Password change success", ref text1);
                CheckCfg<string>("Password change failure", ref text2);
                CheckCfg<string>("Notice name", ref nname);
                SaveConfig();
            }
          
            [ChatCommand("register")]
            void Chat_Register(NetUser netuser, string command, string[] args)
            {
                string result = string.Join(" ", args);
                webrequest.EnqueueGet(string.Format("{0}?steamid={1}&pass={2}", url, netuser.userID.ToString(), result), (code, response) => Chat_Register_CB(code, response, netuser), this);
            }
          
            void OnPlayerConnected(NetUser netuser)
            {
                webrequest.EnqueueGet(string.Format("{0}?steamid={1}&name={2}", url, netuser.userID.ToString(), netuser.userName.ToString()), (code, response) => VoidCallback(code, response), this);
            }
          
            void OnPlayerDisconected(uLink.NetworkPlayer networkPlayer)
            {
                if(netplayer == null)
                    return;
                PlayerClient player = ((NetUser)netplayer.GetLocalData()).playerClient;
                if(player.controllable == null)
                    return;
                if(player.controllable.GetComponent<Character>() == null)
                    return;
                var netUser = netplayer.GetLocalData<NetUser>();
              
                webrequest.EnqueueGet(string.Format("{0}?steamid={1}&name={2}&offline=0", url, netuser.userID.ToString(), netuser.userName.ToString()), (code, response) => VoidCallback(code, response), this);
            }
          
            void Chat_Register_CB(int code, string response, NetUser netuser)
            {
                if (response == 1) {
                    rust.Notice(netuser, text1, nname, 10f)
                } else {
                    rust.Notice(netuser, text2, nname, 10f)
                }
            }
          
            void VoidCallback(int code, string response)
            {        }
    }
    
    Save as SiteRegistration.cs and it's NOT TESTED
     
  12. Welcome to install the plugin, but it gives an error

    [SERVER] Got Message: Exit
    [SERVER] Exit received. Shutdown
    [SERVER] Started as service
    [SERVER] Running as service
    [SERVER] Got Message: Ready
    [SERVER] Got Message: Compile
    [SERVER] Console: SiteRegistration.cs(4,0): error CS1525: Unexpected symbol `using'
    SiteRegistration.cs(5,16): error CS1525: Unexpected symbol `;'
    SiteRegistration.cs(6,26): error CS1525: Unexpected symbol `;'
    SiteRegistration.cs(7,17): error CS1525: Unexpected symbol `;'
    SiteRegistration.cs(71,13): error CS1002: ; expected
    SiteRegistration.cs(73,13): error CS1002: ; expected
    SiteRegistration.cs(79,246): error CS1525: Unexpected symbol `end-of-file'
     
  13. Code:
    using System;
    using System.Collections.Generic;
    using Oxide.Core;
    using Oxide.Core.Libraries;namespace Oxide.Plugins
    {
        [Info("SiteRegistration", "Prefix", 0.1)]
        [Description("Makes epic stuff happen")]    class SiteRegistration : RustLegacyPlugin
        {
         
            public static bool enabled = true;
            public static string url = "http://install.ru/reg.php";
            public static string success = "You have changed your password successfully";
            public static string failure = "Some problems occured with your server, try later.";
            public static string nname = "Registration";
         
            void LoadDefaultConfig() { }
            private void CheckCfg<T>(string Key, ref T var)
            {
                if (Config[Key] is T)
                    var = (T)Config[Key];
                else
                    Config[Key] = var;
            }
         
            void Init()
            {
                CheckCfg<bool>("Enabled", ref enabled);
                CheckCfg<string>("URL", ref url);
                CheckCfg<string>("Password change success", ref success);
                CheckCfg<string>("Password change failure", ref failure);
                CheckCfg<string>("Notice name", ref nname);
                SaveConfig();
            }
         
            [ChatCommand("register")]
            void Chat_Register(NetUser netuser, string command, string[] args)
            {
                string result = string.Join(" ", args);
                webrequest.EnqueueGet(string.Format("{0}?steamid={1}&pass={2}", url, netuser.userID.ToString(), result), (code, response) => Chat_Register_CB(code, response, netuser), this);
            }
         
            void OnPlayerConnected(NetUser netuser)
            {
                webrequest.EnqueueGet(string.Format("{0}?steamid={1}&name={2}", url, netuser.userID.ToString(), netuser.displayName.ToString()), (code, response) => VoidCallback(code, response), this);
            }
         
            void OnPlayerDisconected(uLink.NetworkPlayer networkPlayer)
            {
                if(networkPlayer.GetLocalData<NetUser>() == null)
                    return;
                NetUser netUser = networkPlayer.GetLocalData<NetUser>();
                webrequest.EnqueueGet(string.Format("{0}?steamid={1}&name={2}&offline=0", url, netUser.userID.ToString(), netUser.displayName.ToString()), (code, response) => VoidCallback(code, response), this);
            }
         
            void Chat_Register_CB(int code, string response, NetUser netuser)
            {
                if (response.Equals("1")) {
                    rust.Notice(netuser, success, nname, 10f);
                } else {
                    rust.Notice(netuser, failure, nname, 10f);
                }
            }
         
            void VoidCallback(int code, string response)
            {        }
        }
    }
    
    Sorry but i'm unsure how to fix last error "The name `webrequest` does not exist in the current context`
     
  14. In the logs I get the following:

    [SERVER] Got Message: Exit
    [SERVER] Exit received. Shutdown
    [SERVER] Started as service
    [SERVER] Running as service
    [SERVER] Got Message: Ready
    [SERVER] Got Message: Compile
    [SERVER] Console: SiteRegistration.cs(20,14): warning CS0114: `Oxide.Plugins.SiteRegistration.LoadDefaultConfig()' hides inherited member `Oxide.Core.Plugins.Plugin.LoadDefaultConfig()'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword
    C:\servers\bormutov\rust_oeb2n8_28021\Oxide.Core.dll (Location of the symbol related to previous warning)
    SiteRegistration.cs(43,13): error CS0103: The name `webrequest' does not exist in the current context
    SiteRegistration.cs(48,13): error CS0103: The name `webrequest' does not exist in the current context
    SiteRegistration.cs(56,13): error CS0103: The name `webrequest' does not exist in the current context
     
  15. yes I know what error is, but I don't know how to fix it so wait for @Wulf
     
  16. Wulf

    Wulf Community Admin

    It's available automatically to C# plugins as webrequests, not webrequest.
     
  17. Code:
    webrequests.EnqueueGet(string.Format("{0}?steamid={1}&pass={2}", url, netuser.userID.ToString(), result), (code, response) => Chat_Register_CB(code, response, netuser), this);
    
    still same error.
     
  18. Wulf

    Wulf Community Admin

    Then you're likely outdated. :p

    It's only available in the recent updates, before you had to manually load it yourself.
     
  19. And now what i can do ?
     
  20. Wulf

    Wulf Community Admin

    Update Oxide to the latest release or snapshot.