Player name invalid

I used this script: [Release] Change Pause Menu Name and edited it a bit so it would show the player id and player name along with the server name but the playername is invalid. what would be the correct native(i think thats the correct term) to use for getting the players name?

GetPlayerName(PlayerId())

3 Likes
function AddTextEntry(key, value)
	Citizen.InvokeNative(GetHashKey("ADD_TEXT_ENTRY"), key, value)
end

Citizen.CreateThread(function()
  AddTextEntry("FE_THDR_GTAO", "YOUR SERVER NAME HERE - " .. GetPlayerName(PlayerId()) .. " - " .. PlayerId())
end)
1 Like

I’ll try that here in a bit.

Having it like that broke the script.

Yeah, that happens when I don’t think before I post ^^

Try this:


function AddTextEntry(key, value)
	Citizen.InvokeNative(GetHashKey("ADD_TEXT_ENTRY"), key, value)
end

AddEventHandler("playerSpawned", function(spawn)
  AddTextEntry('FE_THDR_GTAO', 'YOUR_SERVER_NAME - ' .. GetPlayerName(PlayerId()) .. ' - ' .. PlayerId())
end)

nope still broken best luck i have had with this is having it like this https://pastebin.com/9wxD1Ckr the name is invalid on joining but when i restart the script it shows the name. I will leave and join back it says invalid once again.

That’s weird, because that way it worked for me.

I do not understand why it does that.

It is working for me when I do it like this.

function AddTextEntry(key, value)
	Citizen.InvokeNative(GetHashKey("ADD_TEXT_ENTRY"), key, value)
end

AddEventHandler("playerSpawned", function(spawn)
  AddTextEntry('FE_THDR_GTAO', 'FMODT Testing - ' .. GetPlayerName(PlayerId()) .. ' - ' .. PlayerId())
end)

@TheKKeith55 Try sending a chat message containing the player username as a message and just make sure it’s not something with the menu being weird. If the name shows up fine in chat, then it’s something with the menu.

If you want to display the player’s server ID you should do GetPlayerServerId(PlayerId()).

But… You didn’t even read what @Flatracer put did you? You’re missing the AddTextEntry function :confused:
Also, wtf is id? It doesn’t exist…

I know, I just don’t know if he meant the Server ID or the Client ID, because he just wrote that:

:thinking:


That is probably not needed anymore, because the Native got added with the correct name.

Ah, fair point, didn’t see that :stuck_out_tongue:

My comment still stands though:

If you replace id in the pastebin with PlayerId() you should be good.

1 Like

So, I did all the work for you.

Download this, extract it to the resource folder, add start PMTitle to your .cfg - File and you are good to go.

Have Fun :smile:

PMTitle [v1.0.0].rar (692 Bytes)

And if you want some color in it:

PMTitle [v1.0.0][Colorized].rar (704 Bytes)