I'm working on a plugin that changes gives/removes items of a player and changes his name according to a ChatCommand.
I figured out how to give/remove items from the player inventory using a BasePlayer and a RustPlugin.
Is there any way to cast the BasePlayer into an IPlayer or rename the BasePlayer directly ?
Solved Cast a BasePlayer into an IPlayer
Discussion in 'Rust Development' started by mangiang, May 9, 2017.
-
Wulf Community Admin
You can't cast it, you'd have to look up the IPlayer. You can rename the BasePlayer though without using an IPlayer, just use player.displayName = "new name" where you want to set it.
-
Wow ! I've bee stuck for hours trying to figure out a method or a way to cast BasePlayer into IPlayer but it was so simple !
Thaks a lot !! -
Well I tried to change the name with player.displayName.
The name is changed on Rust Admin but other players still see the old name. The inventory still holds the old name too. -
Wulf Community Admin
-
Your plugin Rename updates the name very well but it uses the IPlayer interface.
Logging out works but teleportation doesn't. -
Wulf Community Admin
Oxide/RustPlayer.cs at develop · OxideMod/Oxide · GitHub
- Rename their connection username
- Rename their display name
- Rename their cached name
- Rename their Player name
- Send network updates to player
-
Thanks a lot, it works !
I didn't know there were so many names to change xD