Hey @Wulf I found that the console is also a IPlayer as "server_console" I was wanting to know if it was possible to call its IPlayer like you would a player? example players.FindPlayer("server_console"); I noticed that doesn't really work.
Server Console as IPlayer Calling
Discussion in 'Rust Development' started by Austinv900, Oct 25, 2016.
-
Wulf Community Admin
The server is not stored as a player, it has a special console player. What exactly are you trying to do with it?
-
I was wanting it to be if the ban is issued though another plugin to have ServerConsole as the Issues. I can probably just replace IPlayer as a string instead. but is it possible to call the special console player?
Code:void IssueBan(string steamid, string playername, IPlayer Issuer, string reason = "No Reason Given", string permaban = "0") { BanData pl = null; string PayLoad = $"key={APIKey}&action=ban&steamid={steamid}&playername={playername}&reason={reason}&server={ServerStr}&source={Issuer.Name}&permban={permaban}".Replace(" ", "+").Replace(":", "%3A"); if (Debug) Puts(PayLoad); webrequest.EnqueuePost(URL, PayLoad, (code, response) => { if (code != 200 || string.IsNullOrEmpty(response)) { Issuer.Reply("Failed to add ban to database"); pl = BanData.Ban(steamid, playername, reason, $"{server.Address}:{server.Port}", Issuer.Name, permaban); if(!InternalBanList.Contains(pl)) InternalBanList.Add(pl); SaveData(InternalBanList, $"{Name}/Banlist"); if (!FailedUploads.Contains(pl)) FailedUploads.Add(pl); SaveData(FailedUploads, $"{Name}/FailedUploads"); return; } if (response == "Failed to add ban to database") { Puts("Database did not accept your ban"); return; } Issuer.Reply(response); if (Issuer.Id != "server_console") Puts(response); pl = BanData.Ban(steamid, playername, reason, $"{server.Address}:{server.Port}", Issuer.Name, permaban); if (!InternalBanList.Contains(pl)) InternalBanList.Add(pl); SaveData(InternalBanList, $"{Name}/Banlist"); }, this); }
