Created
May 13, 2020 22:10
-
-
Save FiveEYZ/13eaa5e4e29400315eb497ca21c04e9b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
SendNUIMessage({ action = "close" }) | |
open = false | |
TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(PlayerId())) | |
elseif val == 'checkDriver' then | |
SendNUIMessage({ action = "close" }) | |
open = false | |
TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(PlayerId()), 'driver') | |
elseif val == 'checkFirearms' then | |
SendNUIMessage({ action = "close" }) | |
open = false | |
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 | |
SendNUIMessage({ action = "close" }) | |
open = false | |
TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(player)) | |
elseif val == 'showDriver' then | |
SendNUIMessage({ action = "close" }) | |
open = false | |
TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(player), 'driver') | |
elseif val == 'showFirearms' then | |
SendNUIMessage({ action = "close" }) | |
open = false | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment