I am having trouble converting SteamId to Player Name ..
Can you help me?
Solved Getting player name from Steam ID?
Discussion in 'Rust Development' started by Noobgamex, Feb 13, 2017.
-
Wulf Community Admin
var player = BasePlayer.FindPlayer(steamId);
var name = player.displayName; -
Code:namespace Oxide.Plugins { [Info("Inventory Cleaner", "PaiN", "1.1.3", ResourceId = 0)] [Description("This plugin allows players with permission to clean all/their/target's inventory.")] class InventoryCleaner : RustPlugin { void Loaded() => permission.RegisterPermission(this.Name.ToLower()+".use", this); [ChatCommand("Limparinvtodos")] void cmdInvCleanAll(BasePlayer player, string cmd, string[] args) { string steamId = Convert.ToString(player.userID); if (permission.UserHasPermission(steamId, "inventorycleaner.use")) { if (args.Length == 1) { SendReply(player, "Digite: <color='#007FFF'>/limparinvtodos</color>\n~Para limpar inventario de todos jogadores"); return; } var players = BasePlayer.activePlayerList as List<BasePlayer>; foreach (BasePlayer current in BasePlayer.activePlayerList) { current.inventory.Strip(); Puts(player.displayName + " Você limpou todos os inventarios!"); PrintToChat("<color=orange>[Limpeza]</color> " + player.displayName + " limpou o inventario de todos: (" + players.Count + ") !"); SendReply(player, "<color=orange>[Limpeza]</color> " + "Você limpo o inventario dos seguintes jogadores: " + players.Count + ""); } } else { SendReply(player, "Você nao tem permissao para usar este comando!"); return; } }
-
Wulf Community Admin
-
Code:Failed to call hook 'cmdInvClean' on plugin 'InventoryCleaner v1.1.3' (NullReferenceException: Object reference not set to an instance of an object)
LOG
Code:19:20 [Stacktrace] at Oxide.Plugins.InventoryCleaner.cmdInvClean (.BasePlayer player, System.String cmd, System.String[] args) [0x00000] in <filename unknown>:0 at Oxide.Plugins.InventoryCleaner.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00000] in <filename unknown>:0 at Oxide.Plugins.CSharpPlugin.InvokeMethod (HookMethod method, System.Object[] args) [0x00000] in <filename unknown>:0 at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x00000] in <filename unknown>:0 at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00000] in <filename unknown>:0
-
Wulf Community Admin
-
Code:
var trajeto = BasePlayer.FindPlayer(steamId);
Code:Error while compiling InventoryCleaner.cs(60,30): error CS0117: `BasePlayer' does not contain a definition for `FindPlayer'
Last edited by a moderator: Feb 14, 2017 -
Wulf Community Admin
-
Ex:
Code:/limparinv "Theusz"
Only works if I enter the player ID, if I enter the Name does not work -
Wulf Community Admin