A script to make ID card on police station

hello is there any script that the new players when they connect go to a specific location and make id there? like press a button and start making id card as esx identity does.
thanks :smiley:

Anyone could help?

Hi StonrbridgeGR

Your questions depend on which framework you are using. Are you using ESX, vRP, or something else - maybe a custom?

Nylander

I have not tried error may occur and delete strings “EnableGui(true)” inside client.lua

Script,

Client side

local hasIdentity = false
local location = vector3(1.0,1.0,1.0)
Citizen.CreateThread(function()
	local sleep = 100
	while true do
		if not hasIdentity then
			sleep = 7
			local playerPed = PlayerPedId()
			local coords = GetEntityCoords(playerPed)
			if GetDistanceBetweenCoords(coords, location, true) < 2.0 then
				HelpNotif("Press E to take id card")
				if IsControlJustPressed(0, 46) then
					TriggerServerEvent("esx_identity:checkIdentityH")
					Citizen.Wait(10)
					if not hasIdentity then
						EnableGui(true)
					else
						break
					end
				end
				TriggerServerEvent("esx_identity:checkIdentityH")
				if hasIdentity then 
					break 
				end
			else
				TriggerServerEvent("esx_identity:checkIdentityH")
				if hasIdentity then 
					break 
				end
			end
		else
			sleep = 100
			break
		end
		Citizen.Wait(sleep)
	end
end)

function HelpNotif(msg)
    BeginTextCommandDisplayHelp("STRING")
    AddTextComponentSubstringPlayerName(msg)
    EndTextCommandDisplayHelp(0, 0, 1, -1)
end

RegisterNetEvent('esx_identity:checkIdentityH')
AddEventHandler('esx_identity:checkIdentityH', function(has)
	hasIdentity = has
end)

Server side

RegisterNetEvent("esx_identity:checkIdentityH")
AddEventHandler("esx_identity:checkIdentityH", function()
	local xPlayer = ESX.GetPlayerFromId(source)
	if xPlayer.get('firstName') then
		TriggerClientEvent("esx_identity:checkIdentityH", xPlayer.source, true)
	else
		TriggerClientEvent("esx_identity:checkIdentityH", xPlayer.source, false)
	end
end)
1 Like

could you please explain this?

I send you codes but i dont know your esx_identity version i cant tell you line. You need paste it all codes server, client side and search in client.lua “EnableGui(true)” and you need to delete everything find

GitHub - esx-framework/esx_identity this one i am using last version of it, if you have another version esx identity i can replace it no problem

Client,
main-client.lua (3.8 KB)

Server,
main-server.lua (18.7 KB)

for last version. rename files “main-client.lua” to “main.lua” and “main-server.lua” to “main.lua”

alright so i replace this for esx identity, i am gonna try it thanksss

doesn´t work maybe change the 10 line in server.lua xPlayer.get(‘firstName’) for xPlayer.getName()

What error are you getting

Screenshot_14
i am getting this while trying to make identity :confused: i replaced your files


the exact error :confused:

Have you backed up your own files? If you backed it up, send it to me and I can fix it and send it to you.

yes its this script exact as it is which i been using the whole time

Maybe if not works send me your client and server files
Client,
main.lua (3.7 KB)
Server,
main.lua (18.7 KB)