diff --git a/server-data/resources/[esx_addons]/esx-qalle-jail/client/client.lua b/server-data/resources/[esx_addons]/esx-qalle-jail/client/client.lua index ddf87e45a..9b96ddb84 100644 --- a/server-data/resources/[esx_addons]/esx-qalle-jail/client/client.lua +++ b/server-data/resources/[esx_addons]/esx-qalle-jail/client/client.lua @@ -267,8 +267,7 @@ function DeliverPackage(packageId) end function OpenJailMenu() - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'jail_prison_menu', + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'jail_prison_menu', { title = "Prison Menu", align = 'center', diff --git a/server-data/resources/[esx_addons]/esx-qalle-jail/fxmanifest.lua b/server-data/resources/[esx_addons]/esx-qalle-jail/fxmanifest.lua index 8a5e01494..76ae5ee15 100644 --- a/server-data/resources/[esx_addons]/esx-qalle-jail/fxmanifest.lua +++ b/server-data/resources/[esx_addons]/esx-qalle-jail/fxmanifest.lua @@ -1,8 +1,8 @@ fx_version 'adamant' game 'gta5' -author 'qalle-git; refactor bitpredator' +author 'qalle-git; rework by: bitpredator' lua54 'yes' -version '0.0.4' +version '1.0.0' description "Jail Script With Working Job" shared_script '@es_extended/imports.lua' diff --git a/server-data/resources/[esx_addons]/esx-qalle-jail/locales/en.lua b/server-data/resources/[esx_addons]/esx-qalle-jail/locales/en.lua index e749aa754..93c68547c 100644 --- a/server-data/resources/[esx_addons]/esx-qalle-jail/locales/en.lua +++ b/server-data/resources/[esx_addons]/esx-qalle-jail/locales/en.lua @@ -10,4 +10,7 @@ Locales['en'] = { ['put_something'] = 'You need to put something here!', ['jail_empty'] = 'Your jail is empty!', ['not_officer'] = 'You are not an officer!', + ['invalid_time'] = 'This time is invalid', + ['id_not_online'] = 'This ID is not online', + ['money_for_food'] = 'Here you have som cash for food!' } \ No newline at end of file diff --git a/server-data/resources/[esx_addons]/esx-qalle-jail/locales/it.lua b/server-data/resources/[esx_addons]/esx-qalle-jail/locales/it.lua index 2f143ab23..a0d716aa0 100644 --- a/server-data/resources/[esx_addons]/esx-qalle-jail/locales/it.lua +++ b/server-data/resources/[esx_addons]/esx-qalle-jail/locales/it.lua @@ -10,4 +10,7 @@ Locales['it'] = { ['put_something'] = 'Devi mettere qualcosa qui!', ['jail_empty'] = 'La tua prigione è vuota!', ['not_officer'] = 'Non sei un ufficiale!', + ['invalid_time'] = 'Questo tempo non è valido', + ['id_not_online'] = 'Questo ID non è online', + ['money_for_food'] = 'Eccoti un po\' di soldi per il cibo!', } \ No newline at end of file diff --git a/server-data/resources/[esx_addons]/esx-qalle-jail/server/server.lua b/server-data/resources/[esx_addons]/esx-qalle-jail/server/server.lua index ffaebbfa0..bb3363405 100644 --- a/server-data/resources/[esx_addons]/esx-qalle-jail/server/server.lua +++ b/server-data/resources/[esx_addons]/esx-qalle-jail/server/server.lua @@ -1,7 +1,6 @@ -ESX = nil ESX = exports["es_extended"]:getSharedObject() -RegisterCommand("jail", function(src, args, raw) +RegisterCommand("jail", function(src, args, raw) local xPlayer = ESX.GetPlayerFromId(src) if xPlayer["job"]["name"] == "police" then @@ -23,13 +22,13 @@ RegisterCommand("jail", function(src, args, raw) end) end else - TriggerClientEvent("esx:showNotification", src, "This time is invalid!") + TriggerClientEvent("esx:showNotification", src, _U('invalid_time')) end else - TriggerClientEvent("esx:showNotification", src, "This ID is not online!") + TriggerClientEvent("esx:showNotification", src, _U("id_not_online")) end else - TriggerClientEvent("esx:showNotification", src, "You are not an officer!") + TriggerClientEvent("esx:showNotification", src, _U('not_officer')) end end) @@ -44,10 +43,10 @@ RegisterCommand("unjail", function(src, args) if GetPlayerName(jailPlayer) ~= nil then UnJail(jailPlayer) else - TriggerClientEvent("esx:showNotification", src, "This ID is not online!") + TriggerClientEvent("esx:showNotification", src, _U("id_not_online")) end else - TriggerClientEvent("esx:showNotification", src, "You are not an officer!") + TriggerClientEvent("esx:showNotification", src, _U('not_officer')) end end) @@ -56,7 +55,7 @@ AddEventHandler("esx-qalle-jail:jailPlayer", function(targetSrc, jailTime, jailR local src = source local targetSrc = tonumber(targetSrc) local xPlayer = ESX.GetPlayerFromId(src) - + if xPlayer.job.name == 'police' then JailPlayer(targetSrc, jailTime) @@ -78,8 +77,7 @@ AddEventHandler("esx-qalle-jail:unJailPlayer", function(targetIdentifier) if xPlayer ~= nil then UnJail(xPlayer.source) else - MySQL.Async.execute( - "UPDATE users SET jail = @newJailTime WHERE identifier = @identifier", + MySQL.Async.execute("UPDATE users SET jail = @newJailTime WHERE identifier = @identifier", { ['@identifier'] = targetIdentifier, ['@newJailTime'] = 0 @@ -100,12 +98,9 @@ end) RegisterServerEvent("esx-qalle-jail:prisonWorkReward") AddEventHandler("esx-qalle-jail:prisonWorkReward", function() local src = source - local xPlayer = ESX.GetPlayerFromId(src) - xPlayer.addMoney(math.random(13, 21)) - - TriggerClientEvent("esx:showNotification", src, "Thanks, here you have som cash for food!") + TriggerClientEvent("esx:showNotification", src, _U('money_for_food')) end) function JailPlayer(jailPlayer, jailTime) @@ -123,12 +118,10 @@ end function EditJailTime(source, jailTime) local src = source - local xPlayer = ESX.GetPlayerFromId(src) local Identifier = xPlayer.identifier - MySQL.Async.execute( - "UPDATE users SET jail = @newJailTime WHERE identifier = @identifier", + MySQL.Async.execute("UPDATE users SET jail = @newJailTime WHERE identifier = @identifier", { ['@identifier'] = Identifier, ['@newJailTime'] = tonumber(jailTime) @@ -147,7 +140,7 @@ function GetRPName(playerId, data) end ESX.RegisterServerCallback("esx-qalle-jail:retrieveJailedPlayers", function(source, cb) - + local jailedPersons = {} MySQL.Async.fetchAll("SELECT firstname, lastname, jail, identifier FROM users WHERE jail > @jail", { ["@jail"] = 0 }, function(result) @@ -155,7 +148,6 @@ ESX.RegisterServerCallback("esx-qalle-jail:retrieveJailedPlayers", function(sour for i = 1, #result, 1 do table.insert(jailedPersons, { name = result[i].firstname .. " " .. result[i].lastname, jailTime = result[i].jail, identifier = result[i].identifier }) end - cb(jailedPersons) end) end) @@ -163,11 +155,9 @@ end) ESX.RegisterServerCallback("esx-qalle-jail:retrieveJailTime", function(source, cb) local src = source - local xPlayer = ESX.GetPlayerFromId(src) local Identifier = xPlayer.identifier - MySQL.Async.fetchAll("SELECT jail FROM users WHERE identifier = @identifier", { ["@identifier"] = Identifier }, function(result) local JailTime = tonumber(result[1].jail) @@ -180,4 +170,4 @@ ESX.RegisterServerCallback("esx-qalle-jail:retrieveJailTime", function(source, c end end) -end) +end) \ No newline at end of file