We've moved! Join us as we continue development on our new site at umod.org!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  1. Hey Guys.
    I have modified the Rustcord Plugin.
    In Discord we have a channel to authorize players that they are on the discord server.
    Works... but... The user can authorize any player endless times. My Idea is now.
    • The User types: !auth {hisSteamID}
    • Check if the Player or the SteamID is connected.
    • Maybe generate a Random TAN that ist send to the player with the SteamID or in Discord.
    • And now the player has repeat the TAN in the Game or Discord.
    • Or give the player a new role in discord after the !auth command that the Channel is not Visible with the new Rank/Role.
    My Code is at the Time very simple (i mean my "edit")
    Code:
            private void DiscordToGameCmd(string command, string param, User author, string channelid)
            {
                if (command == "players")
                {
                    string listStr = string.Empty;
                    var pList = BasePlayer.activePlayerList;
                    int i = 0;
                    foreach (var player in pList)
                    {
                        listStr += player.displayName + " [" + ++i + "]";
                        if (i != pList.Count)
                            listStr += "\n";
                    }
                    Channel.GetChannel(_client, channelid, chan =>
                    {
                        // Connected Players [{count}/{maxplayers}]: {playerslist}
                        chan.CreateMessage(_client, Translate("Discord_PlayersResponse", new Dictionary<string, string>
                        {
                            { "count", Convert.ToString(BasePlayer.activePlayerList.Count) },
                            { "maxplayers", Convert.ToString(ConVar.Server.maxplayers) },
                            { "playerslist", listStr }
                        }));
                    });
                }
                 if (command == "auth")
                {
                    ConsoleSystem.Run(ConsoleSystem.Option.Server.Quiet(), "o.usergroup add " + param + " discord" );
                  
                }
            }
    I use the Discord Extension from "PsychoTea?" and Dylan

    Is there a Site where i finde some discord functions like CreateMessage(); ?

    Or have someone another idea how i can control that a user only can use the auth command once.


    Thanks for your help :)



    Offtopic: Someone know if the ai npc aimcone is more accurate if i put it higher or lower?