1. 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 ?
     
  2. Wulf

    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.
     
  3. 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 !!
     
  4. 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.
     
  5. Wulf

    Wulf Community Admin

    They likely will until logged out and back in. You could try to teleport them slightly or to the same position to force an update.
     
  6. Your plugin Rename updates the name very well but it uses the IPlayer interface.

    Logging out works but teleportation doesn't.
     
  7. Wulf

    Wulf Community Admin

    The plugin uses what Oxide provides, which we do a few more things as well for Rust:
    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
     
  8. Thanks a lot, it works !
    I didn't know there were so many names to change xD