ESX_GiveId

This is my first attempt at a script for FiveM and may be my last since I found it frustrating lol.

I made this script a while back for my server, Paradox Gaming, and I made it because I have yet to come across a simple and clean script that introduces an ID that people can provide to officers or whoever with enough details that makes it seem like an actual ID.

Just type “/giveid” (without the quotations) to the closest player and it will provide the ID to them. It will tell you who you gave your ID to to make it easier to check if you gave it to the correct person. Basic information of that player will be pulled from esx_identity to create that ID. When you are in a vehicle, you can provide that ID but you cannot be outside of a vehicle and hand it to someone in a vehicle. You can give your ID if both are not in a vehicle.

Dependencies: es_extended, esx_identity

Credits: Myself, @Smallo, and a little bit of @Jaymo :slight_smile:

P.S. My gaming community discord is not a place to get help for the script. Just DM me and I’ll try to help if there’s any bugs. I will not help with common sense things.

20190109235123_1

10 Likes

Seems good, but you could add a menu, this would make it a lot easier for people that are new on a server and has no idea from commands.
Very nice design, I may use it :slight_smile:

Great script. Thanks!

2 Likes

Well thats kind of your job to teach them…

I’m very new to the scripting side of FiveM. So I definitely want all the feedback and suggestions to improve on it. I should try to add that in and see if I can figure it out on my own before I cry lol

A menu just for this would be a waste of resources.

I think it’s way better to do a Event Handler, that you can let ppl integrate up against, makes way more sence :slight_smile: Then creating a new menu for it to be honest.

So dont waste your time on that @VillaNuwa

What could be done tho is using the build in ESX method for Getting closest player.

But dont think it would change performance a lot tho, but ye.

local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer()
if closestPlayer ~= -1 and closestDistance <= 3.0 then
--SomeCode
else
    ESX.ShowNotification('No Players Nearby')
end

And this is minor not sure what the performance difference is, maybe someone knows that?

GetPlayerPed(-1)

Insted you can use.

PlayerPedId()

Well, if you’re still trying to figure out how a menu works you could watch this tutorial, I think it’s good enough to learn about it:

And like bzndk says you don’t need to waste your time on something, because someone said that it could be a good feature. You are the developer, so do what you want to do :slight_smile:

I like all the suggestions. Definitely something I can always go into and play around with. Again, this is new for me so quick updates are not foreseeable just yet lol.

Cool stuff.

For some reason when I give the id it displays Gender: then it is blank. no male or female

can we add some information, like job ?

Thats because, if you take 10 seconds to look at the code, you’ll see its searching for an ‘M’ or ‘F’ probably in your database they are lower case, so adjust accordingly.

Works great, thank you!

1 Like

Can you modify this to either do one of the following:

If you are a cop (esx_policejob) and someone does /giveid, it loads all the data you would see in the citizen menu.

OR just have it trigger that popup for others?

Thanks. Didn’t catch that.

Both of you can modify the script to your liking. Just don’t re-release it.

How can i change the Script to make it possible to show me Job, Grade, Phone Number, Height etc.?

I tried to change all Components in the Server.lua but after my changes the Script doesn’t show anything but there were no Errors?

ist this the Part i have to change?

	local result = MySQL.Sync.fetchAll('SELECT firstname, lastname, dateofbirth, sex FROM users WHERE identifier = @identifier', {
		['@identifier'] = GetPlayerIdentifiers(source)[1]
	})
	if result[1] and result[1].firstname and result[1].lastname and result[1].dateofbirth and result[1].sex then
		--if result[1].skin ~= nil then
		--	local playerSkin = json.decode(result[1].skin)
		--	local eyeColor = eyeColours[playerSkin["eye_color"] + 1]
		--end
		--local feet, inches = tostring(result[1].height / 30.48):match("([^.]+).([^.]+)")
		--local properinches = math.ceil((tonumber(string.sub(inches, 1, 2)) / 100) * 12)
		local gender = ""
		if result[1].sex == "M" then
			gender = "Male"
		elseif result[1].sex == "F" then
			gender = "Female"
		end
		return ("Name: %s %s\nDOB: %s\nGender: %s\nEye Color: %s"):format(result[1].firstname, result[1].lastname, result[1].dateofbirth, gender, eyeColor)
		--return ("Name: %s %s\nDOB: %s\nGender: %s"):format(result[1].firstname, result[1].lastname, result[1].dateofbirth, gender)

type or paste code here

Hey man love this good job. Is there a way for you to add so police can check there id when a person is cuff or just in general?

Or if someone can help me to add it. And thx!

Where would I change the location of the notification? I would like to have it moved up a little from the bottom left, However cant find anything in the code.

Has anyone found how to change the background of the id? I want it to look more like a license

keeps returning the player name instead and i cant find why, anyone else had this issue?