Git Product home page Git Product logo

zrx_uniqueid's Introduction

Hi πŸ‘‹, I'm zRxnx

A learning FiveM scripter

zrxnx

  • πŸ”­ I’m currently working on several scripts

  • 🌱 I’m currently learning C & HTML

  • πŸ‘¨β€πŸ’» All of my projects are available at zRxnx

  • πŸ“ My documentation site Docs

  • πŸ’° Donation site 24fire

Connect with me:

rene5547 mcN25FJ33K

Languages and Tools:

c docker html5 linux mariadb mysql sqlite

Β zrxnx

zrx_uniqueid's People

Contributors

zrxnx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

zrx_uniqueid's Issues

error menu

^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

Export UID in Draw3DText on another player's head

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.

imagen_2023-12-30_160929915

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.

not saving ID

Well, when starting the script it is working normally, but when relogging I noticed that it is not missing the ID, fixing the id.

image
and another error would be when trying to change the ID to 1 it gave me these errors.

image
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.