Merge branch 'master' into master

This commit is contained in:
Samuel
2018-08-19 12:51:28 +02:00
committed by GitHub
6 changed files with 53 additions and 24 deletions
+9
View File
@@ -0,0 +1,9 @@
root = true
[*]
indent_size = 4
indent_style = tab
end_of_line = crlf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
View File
+4
View File
@@ -16,6 +16,7 @@ server_scripts {
'locales/es.lua',
'locales/sv.lua',
'locales/pl.lua',
'locales/cs.lua',
'server/main.lua'
}
@@ -30,5 +31,8 @@ client_scripts {
'locales/es.lua',
'locales/sv.lua',
'locales/pl.lua',
'locales/cs.lua',
'client/main.lua'
}
dependency 'es_extended'
+7 -9
View File
@@ -19,11 +19,9 @@ end)
function ShowJobListingMenu(data)
ESX.TriggerServerCallback('esx_joblisting:getJobsList', function(data)
local elements = {}
for i = 1, #data, 1 do
table.insert(
elements,
{label = data[i].label, value = data[i].value}
)
table.insert(elements, {label = data[i].label, value = data[i].value})
end
ESX.UI.Menu.CloseAll()
@@ -52,7 +50,7 @@ end)
-- Display markers
Citizen.CreateThread(function()
while true do
Citizen.Wait(10)
Citizen.Wait(1)
local coords = GetEntityCoords(GetPlayerPed(-1))
for i=1, #Config.Zones, 1 do
if(GetDistanceBetweenCoords(coords, Config.Zones[i].x, Config.Zones[i].y, Config.Zones[i].z, true) < Config.DrawDistance) then
@@ -65,10 +63,10 @@ end)
-- Activate menu when player is inside marker
Citizen.CreateThread(function()
while true do
Citizen.Wait(10)
local coords = GetEntityCoords(GetPlayerPed(-1))
isInJoblistingMarker = false
local currentZone = nil
Citizen.Wait(1)
local coords = GetEntityCoords(GetPlayerPed(-1))
isInJoblistingMarker = false
local currentZone = nil
for i=1, #Config.Zones, 1 do
if(GetDistanceBetweenCoords(coords, Config.Zones[i].x, Config.Zones[i].y, Config.Zones[i].z, true) < Config.ZoneSize.x / 2) then
isInJoblistingMarker = true
+7
View File
@@ -0,0 +1,7 @@
Locales['cs'] = {
['new_job'] = 'máte novou práci!',
['access_job_center'] = 'zmáčkněte ~INPUT_PICKUP~ pro přístup na ~b~Úřad práce~s~.',
['job_center'] = 'úřad práce',
}
+26 -15
View File
@@ -2,25 +2,36 @@ ESX = nil
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
ESX.RegisterServerCallback('esx_joblisting:getJobsList', function(source, cb)
MySQL.Async.fetchAll(
'SELECT * FROM jobs WHERE whitelisted = false',
{},
function(result)
local data = {}
for i=1, #result, 1 do
table.insert(data, {
value = result[i].name,
label = result[i].label
})
end
cb(data)
MySQL.Async.fetchAll('SELECT * FROM jobs WHERE whitelisted = @whitelisted', {
['@whitelisted'] = false
}, function(result)
local data = {}
for i=1, #result, 1 do
table.insert(data, {
value = result[i].name,
label = result[i].label
})
end
)
cb(data)
end)
end)
RegisterServerEvent('esx_joblisting:setJob')
AddEventHandler('esx_joblisting:setJob', function(job)
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
xPlayer.setJob(job, 0)
end)
MySQL.Async.fetchAll('SELECT whitelisted FROM jobs WHERE name = @name', {
['@name'] = job,
}, function(result)
if not result[1].whitelisted then
xPlayer.setJob(job, 0)
else
print(('esx_joblisting: %s attempted to set a whitelisted job! (lua injector)'):format(xPlayer.identifier))
end
end)
end)