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.
Solved Modifying player's chat name
Discussion in 'Rust Development' started by TheRotAG, Dec 15, 2014.
-
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 -
baseplayer.displayName = "new_name"
PROFIT! -
Aha didnt know we could do that xD
-
-
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
and if I change basePlayer.displayName to player.basePlayer.displayName it returns "attempt to index field 'basePlayer' (a string value)" -
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
-
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? -
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.
-
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? -
-
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! -
-
Wulf Community Admin
-
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.