Player id!


#1

Hello guys, can someone help me? I am trying to make player id to show up in the chat window, but it doesn’t work…i’m not so good at scripting, i start doing it 2 days ago, sorry for my English…
This is the what i’ve done…
AddEventHandler(‘chat:addTemplate’, function(id, html)
SendNUIMessage({
type = ‘ON_TEMPLATE_ADD’,
template = {
id = id,
html = html
}
})
end)


#2

Why don’t you show people the code you already wrote


#3

Oh, yes, sorry. That’s the part with the id: AddEventHandler(‘chat:addTemplate’, function(id, html)
SendNUIMessage({
type = ‘ON_TEMPLATE_ADD’,
template = {
id = id,
html = html
}
})
end)


#4

And you want this to be all the time?


#5

Maybe you could try this on a server script?

AddEventHandler("chatMessage", function(source, color, message)
	if #message[1] ~= "/" then
		CancelEvent()
		TriggerClientEvent("chatMessage", -1, tostring("^1[ "..source.." ] " .. GetPlayerName(source)))
	end
end)

I don’t mess with the chat events at all… So I am just kinda guessing.


#6

I will try it now, thank you!
Edit: I tried, it doesn’t work, i will keep looking on forums.


#7

Did it give you an error at all?


#8

No, console is clean, no errors in it!


#9

Server:

RegisterCommand('showid', function(source)
	print(source)
end)

#10

He wants it to be in their messages.


#11

Oh. :man_facepalming:as in when a user just sends a message?


#12

I believe so yes.



#13

Is when players talk in chat to see their id…


#14

thanks for help, but it’s still doesn’t work…


#15

you need to create a new chat template, cant help you with that as ive never done it but should be easy to research :smiley: