-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #703 from bitpredator/dev
conversion: Initial work on converting jsfour-idcard to bpt_idcard
- Loading branch information
Showing
35 changed files
with
13,284 additions
and
12,596 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
117 changes: 117 additions & 0 deletions
117
server-data/resources/[bpt_addons]/bpt_idcard/README.md
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
<h1 align='center'>bpt_idcard</a></h1> | ||
<p align='center'><a href='https://discord.gg/ksGfNvDEfq'>Discord</a> | ||
|
||
Copyright (C) 2024 bitpredator | ||
|
||
## SCREENSHOTS | ||
![screenshot](https://i.gyazo.com/645a490f474296a9c5ce2a05a16a33c9.png) | ||
![screenshot](https://i.gyazo.com/f4c14b2efe6f0ff8c88098a4a524e8be.png) | ||
![screenshot](https://i.gyazo.com/0aaeaa5b78cd2bef98ee9185bc5295c8.png) | ||
|
||
## USAGE | ||
|
||
Example on how to add a button-event since people don't want to learn: | ||
https://pastebin.com/UPQRcAei | ||
|
||
```lua | ||
-- ### Event usages: | ||
|
||
-- Look at your own ID-card | ||
TriggerServerEvent('bpt_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('bpt_idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(player)) | ||
else | ||
ESX.ShowNotification('No players nearby') | ||
end | ||
|
||
|
||
-- Look at your own driver license | ||
TriggerServerEvent('bpt_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('bpt_idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(player), 'driver') | ||
else | ||
ESX.ShowNotification('No players nearby') | ||
end | ||
|
||
|
||
-- Look at your own firearms license | ||
TriggerServerEvent('bpt_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('bpt_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('bpt_idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(PlayerId())) | ||
elseif val == 'checkDriver' then | ||
TriggerServerEvent('bpt_idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(PlayerId()), 'driver') | ||
elseif val == 'checkFirearms' then | ||
TriggerServerEvent('bpt_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('bpt_idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(player)) | ||
elseif val == 'showDriver' then | ||
TriggerServerEvent('bpt_idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(player), 'driver') | ||
elseif val == 'showFirearms' then | ||
TriggerServerEvent('bpt_idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(player), 'weapon') | ||
end | ||
else | ||
TriggerClientEvent("esx:showNotification", _source, TranslateCap("no_license_type")) | ||
end | ||
end | ||
end, | ||
function(data, menu) | ||
menu.close() | ||
end | ||
) | ||
end | ||
``` | ||
|
||
This program Is free software: you can redistribute it And/Or modify it under the terms Of the GNU General Public License As published by the Free Software Foundation, either version 3 Of the License, Or (at your option) any later version. | ||
|
||
This program Is distributed In the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty Of MERCHANTABILITY Or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License For more details. | ||
|
||
ATTENTION: | ||
You are not authorized to change the name of the resource and the resources within it. | ||
|
||
If you want to contribute you can open a pull request. | ||
|
||
You are not authorized to sell this software (this is free project). | ||
|
||
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. | ||
|
||
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/. |
4 changes: 2 additions & 2 deletions
4
...ces/[esx_addons]/jsfour-idcard/client.lua → ...s/[bpt_addons]/bpt_idcard/client/main.lua
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
File renamed without changes.
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
5 changes: 0 additions & 5 deletions
5
...dcard/html/assets/css/materialize.min.css → ...dcard/html/assets/css/materialize.min.css
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
80 changes: 80 additions & 0 deletions
80
server-data/resources/[bpt_addons]/bpt_idcard/html/assets/css/style.css
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
@font-face { | ||
font-family: justsignature; | ||
src: url('../fonts/justsignature/JustSignature.woff'); | ||
} | ||
|
||
body, | ||
html { | ||
width: 100%; | ||
height: 100%; | ||
} | ||
|
||
p { | ||
padding: 0; | ||
margin: 0; | ||
text-transform: uppercase; | ||
color: #9e9e9e; | ||
font-size: 12px; | ||
} | ||
|
||
#id-card { | ||
position: relative; | ||
display: none; | ||
margin: 230px 50px 0 0; | ||
float: right; | ||
width: 457px; | ||
height: 272px; | ||
padding: 54px 17px 10px 144px; | ||
background: url("../images/idcard.png"); | ||
} | ||
|
||
img { | ||
position: absolute; | ||
left: 7px; | ||
top: 5px; | ||
} | ||
|
||
#name { | ||
font-weight: bolder; | ||
font-size: 18px; | ||
color: #282828; | ||
} | ||
|
||
#inline { | ||
position: absolute; | ||
top: 109px; | ||
} | ||
|
||
#dob { | ||
position: absolute; | ||
left: 0; | ||
width: 100px; | ||
} | ||
|
||
#sex { | ||
position: absolute; | ||
left: 90px; | ||
} | ||
|
||
#height { | ||
position: absolute; | ||
left: 150px; | ||
width: 60px; | ||
} | ||
|
||
#signature { | ||
position: absolute; | ||
bottom: 76px; | ||
left: 152px; | ||
color: #b1b177; | ||
font-size: 19px; | ||
text-transform: capitalize; | ||
font-family: justsignature; | ||
} | ||
|
||
#licenses { | ||
position: absolute; | ||
top: 109px; | ||
right: 33px; | ||
width: 50px; | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
75 changes: 75 additions & 0 deletions
75
server-data/resources/[bpt_addons]/bpt_idcard/html/assets/js/init.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
$(document).ready(function () { | ||
// LUA listener | ||
window.addEventListener('message', function (event) { | ||
if (event.data.action == 'open') { | ||
var type = event.data.type; | ||
var userData = event.data.array['user'][0]; | ||
var licenseData = event.data.array['licenses']; | ||
var sex = userData.sex; | ||
|
||
if (type == 'driver' || type == null) { | ||
$('img').show(); | ||
$('#name').css('color', '#282828'); | ||
|
||
if (sex.toLowerCase() == 'm') { | ||
$('img').attr('src', 'assets/images/male.png'); | ||
$('#sex').text('male'); | ||
} else { | ||
$('img').attr('src', 'assets/images/female.png'); | ||
$('#sex').text('female'); | ||
} | ||
|
||
$('#name').text(userData.firstname + ' ' + userData.lastname); | ||
$('#dob').text(userData.dateofbirth); | ||
$('#height').text(userData.height); | ||
$('#signature').text(userData.firstname + ' ' + userData.lastname); | ||
|
||
if (type == 'driver') { | ||
if (licenseData != null) { | ||
Object.keys(licenseData).forEach(function (key) { | ||
var type = licenseData[key].type; | ||
|
||
if (type == 'drive_bike') { | ||
type = 'bike'; | ||
} else if (type == 'drive_truck') { | ||
type = 'truck'; | ||
} else if (type == 'drive') { | ||
type = 'car'; | ||
} | ||
|
||
if (type == 'bike') { | ||
$('#licenses').append('<p>' + 'Bike' + '</p>'); | ||
} else if (type == 'truck') { | ||
$('#licenses').append('<p>' + 'Truck' + '</p>'); | ||
} else if (type == 'car') { | ||
$('#licenses').append('<p>' + 'Car' + '</p>'); | ||
} | ||
}); | ||
} | ||
|
||
$('#id-card').css('background', 'url(assets/images/license.png)'); | ||
} else { | ||
$('#id-card').css('background', 'url(assets/images/idcard.png)'); | ||
} | ||
} else if (type == 'weapon') { | ||
$('img').hide(); | ||
$('#name').css('color', '#d9d9d9'); | ||
$('#name').text(userData.firstname + ' ' + userData.lastname); | ||
$('#dob').text(userData.dateofbirth); | ||
$('#signature').text(userData.firstname + ' ' + userData.lastname); | ||
|
||
$('#id-card').css('background', 'url(assets/images/firearm.png)'); | ||
} | ||
|
||
$('#id-card').show(); | ||
} else if (event.data.action == 'close') { | ||
$('#name').text(''); | ||
$('#dob').text(''); | ||
$('#height').text(''); | ||
$('#signature').text(''); | ||
$('#sex').text(''); | ||
$('#id-card').hide(); | ||
$('#licenses').html(''); | ||
} | ||
}); | ||
}); |
File renamed without changes.
Oops, something went wrong.