zrxnx / zrx_uniqueid Goto Github PK
View Code? Open in Web Editor NEWAn advanced unique id system for FiveM
License: GNU General Public License v3.0
An advanced unique id system for FiveM
License: GNU General Public License v3.0
Hello, good morning.
I was trying to show the UID of each player in his head with "exports.zrx_uniqueid:GetUID" but the only thing I got was to show my own UID over their heads, I wanted to know if it is possible to export the UID of each player in his head.
I will leave the code that I use to show the ids, I have been doing this for a few days, I am quite new to the subject but I wanted to clear my doubt if it is possible to do it or not, since I do not know if I am making a mistake or directly with the export that I am using it is not possible to obtain the result that I am looking for.
Citizen.CreateThread(function()
TriggerServerEvent("tgiann-showid:add-id")
while true do
Citizen.Wait(1)
if IsControlPressed(0, TGIANN.key) or forceDraw then
for k, v in pairs(GetNeareastPlayers()) do
local x, y, z = table.unpack(v.coords)
local textoCompleto = v.playerId .. " - " .. v.idunica
Draw3DText(x, y, z + 1.1, textoCompleto, 1.6)
Draw3DText(x, y, z + 1.20, v.topText, 1.0)
end
end
end
end)
RegisterNetEvent('tgiann-showid:client:add-id')
AddEventHandler('tgiann-showid:client:add-id', function(identifier, playerSource)
if playerSource then
onlinePlayers[playerSource] = identifier
else
onlinePlayers = identifier
end
end)
RegisterCommand(TGIANN.commandName, function()
if not forceDraw then
forceDraw = not forceDraw
Citizen.Wait(5000)
forceDraw = false
end
end)
function Draw3DText(x, y, z, text, newScale)
local onScreen, _x, _y = World3dToScreen2d(x, y, z)
if onScreen then
local dist = GetDistanceBetweenCoords(GetGameplayCamCoords(), x, y, z, 1)
local scale = newScale * (1 / dist) * (1 / GetGameplayCamFov()) * 100
SetTextScale(scale, scale)
SetTextFont(4)
SetTextProportional(1)
SetTextColour(255, 255, 255, 255)
SetTextDropShadow(0, 0, 0, 0, 255)
SetTextDropShadow()
SetTextEdge(4, 0, 0, 0, 255)
SetTextOutline()
SetTextEntry("STRING")
SetTextCentre(1)
AddTextComponentString(text)
DrawText(_x, _y)
end
end
function GetNeareastPlayers()
local playerPed = PlayerPedId()
local players_clean = {}
local playerCoords = GetEntityCoords(playerPed)
if IsPedInAnyVehicle(playerPed, false) then
local playersId = tostring(GetPlayerServerId(PlayerId()))
local idunica = exports.zrx_uniqueid:GetUID(GetPlayerServerId(NetworkGetEntityOwner(GetPlayerPed(-1))))
table.insert(players_clean, {topText = onlinePlayers[playersId], playerId = playersId, idunica = idunica, coords = playerCoords})
else
local players, _ = GetPlayersInArea(playerCoords, TGIANN.drawDistance)
for i = 1, #players, 1 do
local playerServerId = GetPlayerServerId(players[i])
local player = GetPlayerFromServerId(playerServerId)
local ped = GetPlayerPed(player)
if IsEntityVisible(ped) then
for x, identifier in pairs(onlinePlayers) do
if x == tostring(playerServerId) then
local idunica = exports.zrx_uniqueid:GetUID(GetPlayerServerId(NetworkGetEntityOwner(GetPlayerPed(-1))))
table.insert(players_clean, {topText = identifier:upper(), playerId = playerServerId, idunica = idunica, coords = GetEntityCoords(ped)})
end
end
end
end
end
return players_clean
end
function GetPlayersInArea(coords, area)
local players, playersInArea = GetPlayers(), {}
local coords = vector3(coords.x, coords.y, coords.z)
for i=1, #players, 1 do
local target = GetPlayerPed(players[i])
local targetCoords = GetEntityCoords(target)
if #(coords - targetCoords) <= area then
table.insert(playersInArea, players[i])
end
end
return playersInArea
end
function GetPlayers()
local players = {}
for _, player in ipairs(GetActivePlayers()) do
local ped = GetPlayerPed(player)
if DoesEntityExist(ped) then
table.insert(players, player)
end
end
return players
end ```
I think it would be a good way to be able to identify people who reconnect to change their ids and avoid being sanctioned.
^1SCRIPT ERROR: @zrx_uniqueid/client/functions.lua:34: attempt to index a nil value (field βMenuβ)^7
CORE.Client.CreateMenu({
id = 'zrx_uniqueid:menu:main',
title = Strings.menu_main,
}, MENU, Config.Menu.type ~= 'menu', Config.Menu.postition)
end
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.