Coder Social home page Coder Social logo

jsfour-idcard's Introduction

jsfour-idcard

This is an updated version of my jsfour-legitimation. It has and ID card, firearms license and a driver license

LICENSE

Please don't sell or reupload this resource

INSTALLATION

Drag and drop. You also need to have es_extended and esx_license installed.

You need to add a couple rows of code depending on how you want to use the ID. Please check the Usage down below.

SCREENSHOTS

screenshot screenshot screenshot

USAGE

Example on how to add a button-event since people don't want to learn: https://pastebin.com/UPQRcAei

-- ### Event usages:

-- Look at your own ID-card
TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(PlayerId()))

-- Show your ID-card to the closest person
local player, distance = ESX.Game.GetClosestPlayer()

if distance ~= -1 and distance <= 3.0 then
  TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(player))
else
  ESX.ShowNotification('No players nearby')
end


-- Look at your own driver license
TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(PlayerId()), 'driver')

-- Show your driver license to the closest person
local player, distance = ESX.Game.GetClosestPlayer()

if distance ~= -1 and distance <= 3.0 then
  TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(player), 'driver')
else
  ESX.ShowNotification('No players nearby')
end


-- Look at your own firearms license
TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(PlayerId()), 'weapon')

-- Show your firearms license to the closest person
local player, distance = ESX.Game.GetClosestPlayer()

if distance ~= -1 and distance <= 3.0 then
  TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(player), 'weapon')
else
  ESX.ShowNotification('No players nearby')
end

-- ### A menu (THIS IS AN EXAMPLE)
function openMenu()
  ESX.UI.Menu.Open(
	'default', GetCurrentResourceName(), 'id_card_menu',
	{
		title    = 'ID menu',
		elements = {
			{label = 'Check your ID', value = 'checkID'},
			{label = 'Show your ID', value = 'showID'},
			{label = 'Check your driver license', value = 'checkDriver'},
			{label = 'Show your driver license', value = 'showDriver'},
			{label = 'Check your firearms license', value = 'checkFirearms'},
			{label = 'Show your firearms license', value = 'showFirearms'},
		}
	},
	function(data, menu)
		local val = data.current.value
		
		if val == 'checkID' then
			TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(PlayerId()))
		elseif val == 'checkDriver' then
			TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(PlayerId()), 'driver')
		elseif val == 'checkFirearms' then
			TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(PlayerId()), 'weapon')
		else
			local player, distance = ESX.Game.GetClosestPlayer()
			
			if distance ~= -1 and distance <= 3.0 then
				if val == 'showID' then
				TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(player))
				elseif val == 'showDriver' then
			TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(player), 'driver')
				elseif val == 'showFirearms' then
			TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(player), 'weapon')
				end
			else
			  ESX.ShowNotification('No players nearby')
			end
		end
	end,
	function(data, menu)
		menu.close()
	end
)
end

PSD file: https://www.dropbox.com/sh/ho6xq5cmk6sxz6x/AAB3aPJOylL7EWrU6BFb45-0a?dl=0

jsfour-idcard's People

Contributors

jonassvensson4 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

jsfour-idcard's Issues

Problem with the weapon license

Hi, I'm trying to use your script and implement it in my server but when I tryed it for the first time I seen that when I try to see my weapon license the script show me the license, but I never bought a weapon license

Can't show ID card

When I join the server, or restart the script, it will show my ID card, but if I press any button, its dissaper, and never come back.

Stop it from showing every license

Well as the title. The id card shows every license you have. Would be nice to stop weapon license or in my case the dmv test license from showing on you driver id. Otherwise super nice

don't open

i press all my keys, but not its not opening

MySQL Error

Hey, when i click f5 and show your id nothing happends, and i get this message i cmd
[ERROR] [MySQL] [jsfour-idcard] An error happens on MySQL for query "SELECT firstname, lastname, dateofbirth, sex, height, lastdigits FROM users WHERE identifier = 'steam:11000013d88fc51'": ER_BAD_FIELD_ERROR: Unknown column 'lastdigits' in 'field list'
SCRIPT ERROR: @jsfour-idcard/server.lua:14: attempt to index a nil value (local 'user')

ref (@jsfour-idcard/server.lua:14)
(@mysql-async/mysql-async.js:14898)

https://prnt.sc/tuqs1s

SCRIPT ERROR

SCRIPT ERROR: @jsfour-idcard/server.lua:8: attempt to index a nil value

Command

Is there a way to make commands from this

for example

/showID

Wanthing to add these to a radial menu

jsfour_idcard

having an issue with the drivers licence, the other cards show up but not the drivers licence

Add a New Driver category in license card

Hello,
im trying to add a new category for my license card but when i add it the other not showing.

Thats` what ive changed inb server.lua:

function (user)
	if (user[1] ~= nil) then
		MySQL.Async.fetchAll('SELECT type FROM user_licenses WHERE owner = @identifier', {['@identifier'] = identifier},
		function (licenses)
			if type ~= nil then
				for i=1, #licenses, 1 do
					if type == 'driver' then
						if licenses[i].type == 'drive' or licenses[i].type == 'drive_bike' or licenses[i].type == 'drive_truck' or licenses[i].type == 'drive_bus' then
							show = true
						end
					elseif type =='weapon' then
						if licenses[i].type == 'weapon' then
							show = true
						end
					end
				end
			else
				show = true
			end>

And this is in init.js:

if ( type == 'driver' ) {
if ( licenseData != null ) {
Object.keys(licenseData).forEach(function(key) {
var type = licenseData[key].type;

        if ( type == 'drive_bike') {
          type = 'A';
        } else if ( type == 'drive_truck' ) {
          type = 'Ц';
        } else if ( type == 'drive' ) {
          type = 'Б';
        } else if ( type == "drive_bus")

        if ( type == 'A' || type == 'Ц' || type == 'Б' || type == 'Д' ) {
          $('#licenses').append('<p>'+ type +'</p>');
        }
      });
    }

The problem is that when ive add the 4 category its not showing the other and when i remove it then i can see them.

Function opens

how do I remove the function that opens the license with “E” and leave it that opens only with the menu?

Blanco id card

I added your script to my server, did the key event thing...
Now it does show the id card but it doesnt seem to pull info from the database...

Do you know how to solve this?

https://prnt.sc/p08gfa

Picture for ID card. Is it can set?

Hello, great author, I am Chinese, and English is very bad.
Because this great work is lua+js. I really can't do anything about js. Can you help us with it?

Error server.lua

Hello,

I get this error: Failed to execute thread: server.lua:8: attempt to index a nil value

When i pick that solution from #10 then he shows the id card directly when i join...

Problem with Menu

Hello mate. I use your jsfour-idcard for showing IDs to players. I added menu but it doesn't show up.
https://pastebin.com/fNWsAXHD

This is the code. When I press F5, menu doesn't show up and no errors are being dumped. Can you help me to fix this error?

Add a check statement

Thanks for the help the other day! I finally got it working. How do I add a check statement if they have the item or not? If they don't have it, they won't be able to view their car license nor their weapon license. I already made the items for the licenses. So far I am at xPlayer.getInventoryitem('license') and here is the server.lua from jsfour-idcard.

https://pastebin.com/y5AE7NSk

Add a ID card

Hey nice project could you help me i tryed to add a nother id (police-id) and it doesnt work

Use in Radialmenu

I would like to add the functionality of showing ID and stuff in Command form like /showID or /showdriver
so i can import it in the RadialMenu.

Or can i do this in a other way?

SCRIPT ERROR: @jsfour-idcard/server.lua:8: attempt to index a nil value

Error running system event handling function for resource jsfour-idcard: citizen:/scripting/lua/scheduler.lua:41: Failed to execute thread: @jsfour-idcard/server.lua:8: attempt to index a nil value
stack traceback:
@jsfour-idcard/server.lua:8: in upvalue 'handler'
citizen:/scripting/lua/scheduler.lua:219: in function citizen:/scripting/lua/scheduler.lua:218
stack traceback:
[C]: in function 'error'
citizen:/scripting/lua/scheduler.lua:41: in field 'CreateThreadNow'
citizen:/scripting/lua/scheduler.lua:218: in function citizen:/scripting/lua/scheduler.lua:182

Drive-Lizens

Hello! How can I show someone my driving license? I have tried several times before. It does not work! Is not there help somewhere?

License an item ?

Hello, I would like to create an item instead of showing the permit via a menu. A permit which would be specific to each one who would display like the Jsfour currently, roughly make it into an item, an idea of how I could take it? And possibly be able to create fake paper.

Dynamic user images

I've tried changing the init.js file to allow for dynic image files to replace the male and female.png. For example; If they are police it will display a police badge, Ambulance, their crest etc.

I assumed I could do it with this:

    if ( sex.toLowerCase() == 'm' ) {
      $('img').attr('src', 'assets/images/male.png');
      $('#sex').text('male');
	   } else if ( job == 'police' ) {
      $('img').attr('src', 'assets/images/police.png');
    } else
      $('img').attr('src', 'assets/images/female.png');
      $('#sex').text('female'); {
    }

But it clearly requires more. Can you offer some assistance?

Error server.lua

Hello,

I get this error: Failed to execute thread: server.lua:8: attempt to index a nil value

image

jsfour-idcard doesn't work

script is successfully loaded,without errors,but in game I can't show or see my id card or other cards..

ID card

So your id card script does not let me get to a menu to look at my id card or open the menu pls get back to me

Suggestion

Hello,
It would be nice to replace the photo.png file with a more realistic headshot of the character.

SHOWING ID CARD

i have problem with showing id card,why the id card isn't coming out?

Showing ID while in vehicle

When police ask for ID it would be nice for the person to not step out of vehicle in order for the cop to see the ID

ID number and owned licenses

Hi,
thanks a lot for this nice release but i cant see the ID number to search for on the mdc for example.

Also the driver license would be cool if you would see which licenses you owned there like, car, truck etc.
Or have i missed something?

Menu Is Not Opening!

Hello, there I have all the required scripts I start the jsfour-idcard but when I press F5 it's not opening. But when I start jsfour-criminalrecord it works perfectly!

esx_policejob adapt

Hello

I tried alot but i can't find the way...

I want adapt your script to the esx_policejob, when police want to see the ID or the driver licence.

Can you help me pls ?

Thanks

the identity card appears to the spawn

I have a problem hello jsfour! here I can talk to you freely .. I'm the same person who is writing to you [Release] jsfour-idcard [ESX] I solved with the server.lua now I have created this problem. when I get my ID card.

Help mea plase.

SCRIPT ERROR: @jsfour-idcard/server.lua:9: attempt to index a nil value

script error

This always message on my console.

11/12/2019-01:13:56 / SCRIPT ERROR: @jsfour-idcard/server.lua:8: attempt to index a nil value

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.