Giter VIP home page Giter VIP logo

qb-idcard's Introduction

qb-idcard

Github Alp1x Donate Tebex License MIT

Simple id card you can use for qb-core

How to use

Let's delete the default CreateUseableItem codes

  • qb-inventory > server > main.lua > Find and Delete
QBCore.Functions.CreateUseableItem("driver_license", function(source, item)
   for k, v in pairs(QBCore.Functions.GetPlayers()) do
   	local PlayerPed = GetPlayerPed(source)
   	local TargetPed = GetPlayerPed(v)
   	local dist = #(GetEntityCoords(PlayerPed) - GetEntityCoords(TargetPed))
   	if dist < 3.0 then
   		local gender = "Man"
   		if item.info.gender == 1 then
   			gender = "Woman"
   		end
   		TriggerClientEvent('chat:addMessage', v,  {
   				template = '<div class="chat-message advert"><div class="chat-message-body"><strong>{0}:</strong><br><br> <strong>First Name:</strong> {1} <br><strong>Last Name:</strong> {2} <br><strong>Birth Date:</strong> {3} <br><strong>Gender:</strong> {4}<br><strong>Licenses:</strong> {5}</div></div>',
   				args = {
   					"Drivers License",
   					item.info.firstname,
   					item.info.lastname,
   					item.info.birthdate,
   					gender,
   					item.info.type
   				}
   			}
   		)
   	end
   end
end)

QBCore.Functions.CreateUseableItem("id_card", function(source, item)
   for k, v in pairs(QBCore.Functions.GetPlayers()) do
   	local PlayerPed = GetPlayerPed(source)
   	local TargetPed = GetPlayerPed(v)
   	local dist = #(GetEntityCoords(PlayerPed) - GetEntityCoords(TargetPed))
   	if dist < 3.0 then
   		local gender = "Man"
   		if item.info.gender == 1 then
   			gender = "Woman"
   		end
   		TriggerClientEvent('chat:addMessage', v,  {
   				template = '<div class="chat-message advert"><div class="chat-message-body"><strong>{0}:</strong><br><br> <strong>Civ ID:</strong> {1} <br><strong>First Name:</strong> {2} <br><strong>Last Name:</strong> {3} <br><strong>Birthdate:</strong> {4} <br><strong>Gender:</strong> {5} <br><strong>Nationality:</strong> {6}<br><strong>Fingerprint:</strong> {7}</div></div>',
   				args = {
   					"ID Card",
   					item.info.citizenid,
   					item.info.firstname,
   					item.info.lastname,
   					item.info.birthdate,
   					gender,
   					item.info.nationality,
   					item.info.fingerprint
   				}
   			}
   		)
   	end
   end
end)

qb-core > shared > items.lua > add item policecard

inventory > server > main.lua > find QBCore.Commands.Add("giveitem" and add

	elseif itemData["name"] == "weaponlicense" then
		info.firstname = Player.PlayerData.charinfo.firstname
		info.lastname = Player.PlayerData.charinfo.lastname
		info.birthdate = Player.PlayerData.charinfo.birthdate
	elseif itemData["name"] == "lawyerpass" then
		info.firstname = Player.PlayerData.charinfo.firstname
		info.lastname = Player.PlayerData.charinfo.lastname
		info.birthdate = Player.PlayerData.charinfo.birthdate
	elseif itemData["name"] == "policecard" then
		info.firstname = Player.PlayerData.charinfo.firstname
		info.lastname = Player.PlayerData.charinfo.lastname
		info.birthdate = Player.PlayerData.charinfo.birthdate
		info.gender = Player.PlayerData.charinfo.gender
		info.nationality = Player.PlayerData.charinfo.nationality
  • server.cfg ensure qb-idcard or [qb] folder
  • use item {show nui}
  • hide nui key {backspace}

Changelog (v3)

  • Added config.js and language setting
  • More flexible now
  • Added police card and badge prop,animation

License

MIT

qb-idcard's People

Contributors

alp1x avatar divide29 avatar doom-dev avatar ihyajb avatar

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.