Rename player on spawn
#1
I'm try to rename player to custom name on spown. But, it's do not work for me.
Code:
cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_SPAWNED, MyOnPlayerSpawned);

function MyOnPlayerSpawned(Player)
  Player:SetCustomName("CustomName");
  Player:SetName("CustomName2");
end
Reply
Thanks given by:
#2
When I press <TAB> - i see old player name, but when I list players on server (server console) - I see new player name. Is it bug?
Reply
Thanks given by:
#3
I don't think this is even supposed to work. The SetName() method is only useful before the player is spawned for other players, which I think happens before the PLAYER_SPAWNED hook. SetCustomName() should have worked, though.
Reply
Thanks given by:
#4
In the cPlayer class docs: http://apidocs.cuberite.org/cPlayer.html
Reply
Thanks given by:
#5
(09-17-2015, 06:10 AM)xoft Wrote: I don't think this is even supposed to work. The SetName() method is only useful before the player is spawned for other players, which I think happens before the PLAYER_SPAWNED hook. SetCustomName() should have worked, though.

I'm check some time and some combinations and convinced that player not renamed "into" players list. But, other players see new player name after they (not renamed player) reconnect and any operations with player such us kick, kill, etc. work only with new player name.
Reply
Thanks given by:




Users browsing this thread: 4 Guest(s)