Merge pull request #9 from ArkSeyonet/master

Adding Full Support For GCIdentity-esx-version
This commit is contained in:
Jérémie N'gadi
2017-09-06 18:03:16 +02:00
committed by GitHub
2 changed files with 146 additions and 41 deletions
+40 -2
View File
@@ -621,17 +621,55 @@ function OpenIdentityCardMenu(player)
ESX.TriggerServerCallback('esx_policejob:getOtherPlayerData', function(data)
local jobLabel = nil
local jobLabel = nil
local sexLabel = nil
local sex = nil
local dobLabel = nil
local heightLabel = nil
local idLabel = nil
if data.job.grade_label ~= nil and data.job.grade_label ~= '' then
jobLabel = 'Job : ' .. data.job.label .. ' - ' .. data.job.grade_label
else
jobLabel = 'Job : ' .. data.job.label
end
if data.sex ~= nil then
if (data.sex == 'm') or (data.sex == 'M') then
sex = 'Male'
else
sex = 'Female'
end
sexLabel = 'Sex : ' .. sex
else
sexLabel = 'Sex : Unknown'
end
if data.dob ~= nil then
dobLabel = 'DOB : ' .. data.dob
else
dobLabel = 'DOB : Unknown'
end
if data.height ~= nil then
heightLabel = 'Height : ' .. data.height
else
heightLabel = 'Height : Unknown'
end
if data.name ~= nil then
idLabel = 'ID : ' .. data.name
else
idLabel = 'ID : Unknown'
end
local elements = {
{label = _U('name') .. data.firstname .. " " .. data.lastname, value = nil},
{label = sexLabel, value = nil},
{label = dobLabel, value = nil},
{label = heightLabel, value = nil},
{label = jobLabel, value = nil},
{label = idLabel, value = nil},
}
if data.drunk ~= nil then
+106 -39
View File
@@ -127,8 +127,14 @@ ESX.RegisterServerCallback('esx_policejob:getOtherPlayerData', function(source,
})
local user = result[1]
local firstname = user['firstname']
local lastname = user['lastname']
local firstname = user['firstname']
local lastname = user['lastname']
local sex = user['sex']
local dob = tostring(user['dateofbirth'])
local heightInit = user['height']
local heightFeet = tonumber(string.format("%.0f",heightInit / 12, 0))
local heightInches = heightInit % 12
local height = heightFeet .. "\' " .. heightInches .. "\""
local data = {
name = GetPlayerName(target),
@@ -137,7 +143,10 @@ ESX.RegisterServerCallback('esx_policejob:getOtherPlayerData', function(source,
accounts = xPlayer.accounts,
weapons = xPlayer.loadout,
firstname = firstname,
lastname = lastname
lastname = lastname,
sex = sex,
dob = dob,
height = height
}
TriggerEvent('esx_status:getStatus', _source, 'drunk', function(status)
@@ -200,55 +209,113 @@ end)
ESX.RegisterServerCallback('esx_policejob:getVehicleInfos', function(source, cb, plate)
MySQL.Async.fetchAll(
'SELECT * FROM owned_vehicles',
{},
function(result)
if Config.EnableGCIdentity then
MySQL.Async.fetchAll(
'SELECT * FROM owned_vehicles',
{},
function(result)
local foundIdentifier = nil
local foundIdentifier = nil
for i=1, #result, 1 do
for i=1, #result, 1 do
local vehicleData = json.decode(result[i].vehicle)
local vehicleData = json.decode(result[i].vehicle)
if vehicleData.plate == plate then
foundIdentifier = result[i].owner
break
end
end
if foundIdentifier ~= nil then
MySQL.Async.fetchAll(
'SELECT * FROM users WHERE identifier = @identifier',
{
['@identifier'] = foundIdentifier
},
function(result)
local ownerName = result[1].firstname .. " " .. result[1].lastname
local infos = {
plate = plate,
owner = ownerName
}
cb(infos)
end
)
else
local infos = {
plate = plate
}
cb(infos)
if vehicleData.plate == plate then
foundIdentifier = result[i].owner
break
end
end
if foundIdentifier ~= nil then
MySQL.Async.fetchAll(
'SELECT * FROM users WHERE identifier = @identifier',
{
['@identifier'] = foundIdentifier
},
function(result)
local infos = {
plate = plate,
owner = result[1].name
}
cb(infos)
end
)
)
else
MySQL.Async.fetchAll(
'SELECT * FROM owned_vehicles',
{},
function(result)
else
local foundIdentifier = nil
local infos = {
for i=1, #result, 1 do
local vehicleData = json.decode(result[i].vehicle)
if vehicleData.plate == plate then
foundIdentifier = result[i].owner
break
end
end
if foundIdentifier ~= nil then
MySQL.Async.fetchAll(
'SELECT * FROM users WHERE identifier = @identifier',
{
['@identifier'] = foundIdentifier
},
function(result)
local infos = {
plate = plate,
owner = result[1].name
}
cb(infos)
end
)
else
local infos = {
plate = plate
}
}
cb(infos)
cb(infos)
end
end
end
)
)
end
end)