1. Guys,

    I'm trying to create a plugin to modify the chat name from the admins, but when I input the command in the chat (/name newname) the console shows an error about the system not being possible to set a string as the basePlayer field.

    Any advices on how to make oxide accept the name change?


    Thanks in advance & Best regards.
     
  2. You won't be able to do that, probably kinda complicated.
    Easiest way would be to use:

    OnPlayerChat(Assembly-CSharp/chat.say arg)
    detect if it's an admin
    then do
    rust.BroadcastChat("NEWADMINNAME", message)
    then
    return false to block the initial chat
     
  3. baseplayer.displayName = "new_name"
    PROFIT!
     
  4. Aha didnt know we could do that xD
     
  5. Yes! We could :)
     
  6. So, whats wrong here:


    Code:
    function PLUGIN:C_Name(player, cmd, args)
                if args.Length > 0 then
                if HasAcces(player) then       
                local getNew = tostring(args[0])
                basePlayer.displayName = getNew
    Its a small piece of the code... anyway it returns "attempt to index global 'basePlayer' (a nil value)"

    and if I change basePlayer.displayName to player.basePlayer.displayName it returns "attempt to index field 'basePlayer' (a string value)"
     
  7. Code:
    function PLUGIN:C_Name(player, cmd, args)
                if args.Length > 0 then
                if HasAcces(player) then      
                local getNew = tostring(args[0])
                player.displayName = getNew
     
  8. Done! Tnx sir Reneb!
    [DOUBLEPOST=1418695862,1418658387][/DOUBLEPOST]I missed something...

    How can I call net.connection.username in order store it as a string?
     
  9. You probably figured this one out already, but I think you can simply call 'player.net.connection.username' since player is the Type BasePlayer which is a derived Type of BaseNetworkable.
     
  10. Actually I didn't @Mr. Bubbles, but thanks!
    How I'm using other plugins as a base to build mine, I think that I didn't saw that call method before. Can you tell me where did you found it?
     
  11. Decompiler, just check classes & methods and derived types. :)
     
  12. Ow that!

    Actually I download Telerik but didn't tried it yet and seems like its trial...
    Any recomendation of a good free decompiler?

    Tnx!
     
  13. I'm using .NET Reflector, I think someone linked a free one somewhere.
     
  14. Wulf

    Wulf Community Admin

    dotPeek is a free one by JetBrains. https://www.jetbrains.com/decompiler/
     
  15. I use ILSpy just as another alternative. dotPeek was being weird when I tried to install it and I didn't feel like troubleshooting at that moment. LOL.