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…
[Edit] I add this to chat client, now it shows the player id in cat windows when I’m sending messages, but the thing is, If i disconnect from server and reconnect again instead of id 1 It will give me id 2, 3 or 4, depends how many time i reconnect. Does someone know what i have to do to show only 1 single id everytime when i connect or reconnect ?
if not data.canceled then
local id = PlayerId()
local serverID = GetPlayerServerId(PlayerId())
--deprecated
local r, g, b = 0, 0x99, 255
if data.message:sub(1, 1) == '/' then
ExecuteCommand(data.message:sub(2))
else
TriggerServerEvent('_chat:messageEntered', '['..serverID..'] '.. GetPlayerName(id), { r, g, b }, data.message)
end
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)