[Help] Playersname above head

Default resource is display steam player name. How i can display the roleplay names instead steam name?

Heya,
This greatly depends on what resource you are using to handle roleplay names.

i use esx_identity

I’d recommend looking into esx_identity and looking at how it gets the names, then copying the relevant parts over. You should be able to just modify the playernames resource.

Problem is playernames really hard to understand. i alreay know how can get the firstname and lastname from esx_identity. problem is how to add it to playernames

I’ve never tried it myself but I’ve heard that the Custom Head Labels script is easier to mess around with, maybe try with that?

2 Likes

Hey,
Just popping in again to ask if you’ve had any luck with this?
And if you have, would you be so kind as to share your solution here so that others may use it aswell?

so sad. dont have any idead

Here is a solution, first you will have to use esx_policejob (because of this function

I edited Custom Head Labels

Just replace c_hlabels.lua with the one I edited (https://pastebin.com/MEnUQRdj)

How it works:
Every 5 seconds we add every non-cached player to a ‘cache’ to prevent too much sql request to get the player’s first & lastname.

If you have any questions lemme know.

1 Like

Thank for help. you save me!

excuse me can you help me a problem with peds?

Tell me your problem, if I can I will help you out.

Citizen.CreateThread(function()

    local model = 0x06C3F072
    RequestModel(model)
	
    while not HasModelLoaded(model) do
        Citizen.Wait(10)
    end
	
	if Config.EnableNightclubs then
		for _, item in pairs(Config.Shark) do
			local npc = CreatePed(4, model, item.x, item.y, item.z, item.heading, false, false)
			FreezeEntityPosition(npc, false)	
			SetEntityInvincible(npc, false)
            sharkCoords = GetEntityCoords(npc, false)
            plyCoords = GetEntityCoords(GetPlayerPed(-1), false)
            dist = Vdist(plyCoords.x, plyCoords.y, plyCoords.z, sharkCoords.x,  sharkCoords.y , sharkCoords.z)
            if dist <= 20.0 then
			SetPedSeeingRange(npc, 100.0)
			SetPedHearingRange(npc, 80.0)
			SetPedCombatAttributes(npc, 46, 1)
			SetPedFleeAttributes(npc, 0, 0)
			SetPedCombatRange(npc,2)
			SetPedRelationshipGroupHash(npc, GetHashKey(0x06C3F072))
			SetPedDiesInWater(npc, false)
			SetRelationshipBetweenGroups(5,GetHashKey("PLAYER"),GetHashKey("0x06C3F072"))
			SetRelationshipBetweenGroups(5,GetHashKey("0x06C3F072"),GetHashKey("PLAYER"))
            TaskCombatPed(npc, GetPlayerPed(-1), 0, 16)
			
			
			end
		end
	end

i try to add a peds. but it not attack player. do you know why

Error running call reference function for resource esx_policejob: citizen:/scripting/lua/scheduler.lua:403: @esx_policejob/server/main.lua:202: attempt to index a nil value (local 'xPlayer')
stack traceback:
@esx_policejob/server/main.lua:202: in upvalue 'ref'
citizen:/scripting/lua/scheduler.lua:389: in function citizen:/scripting/lua/scheduler.lua:388
[C]: in function 'xpcall'
citizen:/scripting/lua/scheduler.lua:388: in function citizen:/scripting/lua/scheduler.lua:387
stack traceback:
[C]: in function 'error'
citizen:/scripting/lua/scheduler.lua:403: in function citizen:/scripting/lua/scheduler.lua:372
Error running system event handling function for resource es_extended: citizen:/scripting/lua/scheduler.lua:41: Failed to execute thread: citizen:/scripting/lua/MessagePack.lua:830: missing bytes
stack traceback:
[C]: in function 'error'
citizen:/scripting/lua/MessagePack.lua:830: in method 'underflow'
citizen:/scripting/lua/MessagePack.lua:465: in field 'any'
citizen:/scripting/lua/MessagePack.lua:860: in field 'unpack'
citizen:/scripting/lua/scheduler.lua:626: in field '?'
@es_extended/server/functions.lua:33: in field 'TriggerServerCallback'
@es_extended/server/common.lua:88: in upvalue 'handler'
citizen:/scripting/lua/scheduler.lua:219: in function citizen:/scripting/lua/scheduler.lua:218
stack traceback:
[C]: in function 'error'
citizen:/scripting/lua/scheduler.lua:41: in field 'CreateThreadNow'
citizen:/scripting/lua/scheduler.lua:218: in function citizen:/scripting/lua/scheduler.lua:182

it got error when use your namelabel

you are so cool bro
thx for ur answer!