PokerDice

PokerDice

401 Downloads

Using TRP3 character name

Onirim opened this issue ยท 3 comments

commented

If possible, use the TRP3 character name instead of the playerUnit name

commented

depends on what info you have available and who you need to get the name from

-- if you have the player name and realm
local player = AddOn_TotalRP3.Player.CreateFromNameAndRealm(playerName, playerRealmOrNil);
local player = AddOn_TotalRP3.Player.CreateFromGUID(guid);
local player = AddOn_TotalRP3.Player.CreateFromUnit(unitToken);

-- once you have this object, you can grab all the info you need
local rpName = player:GetRoleplayingName();
local firstNameOnly = player:GetFirstName();

you can find all the method for the player object here https://github.com/Total-RP/Total-RP-3/blob/main/totalRP3/Core/Player.lua
(there's also AddOn_TotalRP3.Player.GetCurrentUser() to get your own profile)

commented

I need to change the delimiters for this one, because the TRP3 first name can contain spaces

commented

Done!