Merge branch 'main' into refactor-1

# Conflicts:
#	[esx]/es_extended/client/functions.lua
This commit is contained in:
Csoki
2022-11-27 20:40:34 +01:00
39 changed files with 838 additions and 739 deletions
+218 -217
View File
@@ -821,238 +821,239 @@ function ESX.Game.SetVehicleProperties(vehicle, props)
local pearlescentColor, wheelColor = GetVehicleExtraColours(vehicle)
SetVehicleModKit(vehicle, 0)
if props.plate then
SetVehicleNumberPlateText(vehicle, props.plate)
end
if props.plateIndex then
SetVehicleNumberPlateTextIndex(vehicle, props.plateIndex)
end
if props.bodyHealth then
SetVehicleBodyHealth(vehicle, props.bodyHealth + 0.0)
end
if props.engineHealth then
SetVehicleEngineHealth(vehicle, props.engineHealth + 0.0)
end
if props.tankHealth then
SetVehiclePetrolTankHealth(vehicle, props.tankHealth + 0.0)
end
if props.fuelLevel then
SetVehicleFuelLevel(vehicle, props.fuelLevel + 0.0)
end
if props.dirtLevel then
SetVehicleDirtLevel(vehicle, props.dirtLevel + 0.0)
end
if props.customPrimaryColor then
SetVehicleCustomPrimaryColour(vehicle, props.customPrimaryColor[1], props.customPrimaryColor[2],
props.customPrimaryColor[3])
end
if props.customSecondaryColor then
SetVehicleCustomSecondaryColour(vehicle, props.customSecondaryColor[1], props.customSecondaryColor[2],
props.customSecondaryColor[3])
end
if props.color1 then
SetVehicleColours(vehicle, props.color1, colorSecondary)
end
if props.color2 then
SetVehicleColours(vehicle, props.color1 or colorPrimary, props.color2)
end
if props.pearlescentColor then
SetVehicleExtraColours(vehicle, props.pearlescentColor, wheelColor)
end
if props.wheelColor then
SetVehicleExtraColours(vehicle, props.pearlescentColor or pearlescentColor, props.wheelColor)
end
if props.wheels then
SetVehicleWheelType(vehicle, props.wheels)
end
if props.windowTint then
SetVehicleWindowTint(vehicle, props.windowTint)
end
if props.plate ~= nil then
SetVehicleNumberPlateText(vehicle, props.plate)
end
if props.plateIndex ~= nil then
SetVehicleNumberPlateTextIndex(vehicle, props.plateIndex)
end
if props.bodyHealth ~= nil then
SetVehicleBodyHealth(vehicle, props.bodyHealth + 0.0)
end
if props.engineHealth ~= nil then
SetVehicleEngineHealth(vehicle, props.engineHealth + 0.0)
end
if props.tankHealth ~= nil then
SetVehiclePetrolTankHealth(vehicle, props.tankHealth + 0.0)
end
if props.fuelLevel ~= nil then
SetVehicleFuelLevel(vehicle, props.fuelLevel + 0.0)
end
if props.dirtLevel ~= nil then
SetVehicleDirtLevel(vehicle, props.dirtLevel + 0.0)
end
if props.customPrimaryColor ~= nil then
SetVehicleCustomPrimaryColour(vehicle, props.customPrimaryColor[1], props.customPrimaryColor[2],
props.customPrimaryColor[3])
end
if props.customSecondaryColor ~= nil then
SetVehicleCustomSecondaryColour(vehicle, props.customSecondaryColor[1], props.customSecondaryColor[2],
props.customSecondaryColor[3])
end
if props.color1 ~= nil then
SetVehicleColours(vehicle, props.color1, colorSecondary)
end
if props.color2 ~= nil then
SetVehicleColours(vehicle, props.color1 or colorPrimary, props.color2)
end
if props.pearlescentColor ~= nil then
SetVehicleExtraColours(vehicle, props.pearlescentColor, wheelColor)
end
if props.wheelColor ~= nil then
SetVehicleExtraColours(vehicle, props.pearlescentColor or pearlescentColor, props.wheelColor)
end
if props.wheels ~= nil then
SetVehicleWheelType(vehicle, props.wheels)
end
if props.windowTint ~= nil then
SetVehicleWindowTint(vehicle, props.windowTint)
end
if props.neonEnabled then
SetVehicleNeonLightEnabled(vehicle, 0, props.neonEnabled[1])
SetVehicleNeonLightEnabled(vehicle, 1, props.neonEnabled[2])
SetVehicleNeonLightEnabled(vehicle, 2, props.neonEnabled[3])
SetVehicleNeonLightEnabled(vehicle, 3, props.neonEnabled[4])
end
if props.neonEnabled ~= nil then
SetVehicleNeonLightEnabled(vehicle, 0, props.neonEnabled[1])
SetVehicleNeonLightEnabled(vehicle, 1, props.neonEnabled[2])
SetVehicleNeonLightEnabled(vehicle, 2, props.neonEnabled[3])
SetVehicleNeonLightEnabled(vehicle, 3, props.neonEnabled[4])
end
if props.extras then
if props.extras ~= nil then
for extraId, enabled in pairs(props.extras) do
SetVehicleExtra(vehicle, tonumber(extraId), enabled and 0 or 0)
end
end
if props.neonColor then
SetVehicleNeonLightsColour(vehicle, props.neonColor[1], props.neonColor[2], props.neonColor[3])
end
if props.xenonColor then
SetVehicleXenonLightsColor(vehicle, props.xenonColor)
end
if props.customXenonColor then
SetVehicleXenonLightsCustomColor(vehicle, props.customXenonColor[1], props.customXenonColor[2],
props.customXenonColor[3])
end
if props.modSmokeEnabled then
ToggleVehicleMod(vehicle, 20, true)
end
if props.tyreSmokeColor then
SetVehicleTyreSmokeColor(vehicle, props.tyreSmokeColor[1], props.tyreSmokeColor[2], props.tyreSmokeColor[3])
end
if props.modSpoilers then
SetVehicleMod(vehicle, 0, props.modSpoilers, false)
end
if props.modFrontBumper then
SetVehicleMod(vehicle, 1, props.modFrontBumper, false)
end
if props.modRearBumper then
SetVehicleMod(vehicle, 2, props.modRearBumper, false)
end
if props.modSideSkirt then
SetVehicleMod(vehicle, 3, props.modSideSkirt, false)
end
if props.modExhaust then
SetVehicleMod(vehicle, 4, props.modExhaust, false)
end
if props.modFrame then
SetVehicleMod(vehicle, 5, props.modFrame, false)
end
if props.modGrille then
SetVehicleMod(vehicle, 6, props.modGrille, false)
end
if props.modHood then
SetVehicleMod(vehicle, 7, props.modHood, false)
end
if props.modFender then
SetVehicleMod(vehicle, 8, props.modFender, false)
end
if props.modRightFender then
SetVehicleMod(vehicle, 9, props.modRightFender, false)
end
if props.modRoof then
SetVehicleMod(vehicle, 10, props.modRoof, false)
end
if props.modEngine then
SetVehicleMod(vehicle, 11, props.modEngine, false)
end
if props.modBrakes then
SetVehicleMod(vehicle, 12, props.modBrakes, false)
end
if props.modTransmission then
SetVehicleMod(vehicle, 13, props.modTransmission, false)
end
if props.modHorns then
SetVehicleMod(vehicle, 14, props.modHorns, false)
end
if props.modSuspension then
SetVehicleMod(vehicle, 15, props.modSuspension, false)
end
if props.modArmor then
SetVehicleMod(vehicle, 16, props.modArmor, false)
end
if props.modTurbo then
ToggleVehicleMod(vehicle, 18, props.modTurbo)
end
if props.modXenon then
ToggleVehicleMod(vehicle, 22, props.modXenon)
end
if props.modFrontWheels then
SetVehicleMod(vehicle, 23, props.modFrontWheels, false)
end
if props.modBackWheels then
SetVehicleMod(vehicle, 24, props.modBackWheels, false)
end
if props.modPlateHolder then
SetVehicleMod(vehicle, 25, props.modPlateHolder, false)
end
if props.modVanityPlate then
SetVehicleMod(vehicle, 26, props.modVanityPlate, false)
end
if props.modTrimA then
SetVehicleMod(vehicle, 27, props.modTrimA, false)
end
if props.modOrnaments then
SetVehicleMod(vehicle, 28, props.modOrnaments, false)
end
if props.modDashboard then
SetVehicleMod(vehicle, 29, props.modDashboard, false)
end
if props.modDial then
SetVehicleMod(vehicle, 30, props.modDial, false)
end
if props.modDoorSpeaker then
SetVehicleMod(vehicle, 31, props.modDoorSpeaker, false)
end
if props.modSeats then
SetVehicleMod(vehicle, 32, props.modSeats, false)
end
if props.modSteeringWheel then
SetVehicleMod(vehicle, 33, props.modSteeringWheel, false)
end
if props.modShifterLeavers then
SetVehicleMod(vehicle, 34, props.modShifterLeavers, false)
end
if props.modAPlate then
SetVehicleMod(vehicle, 35, props.modAPlate, false)
end
if props.modSpeakers then
SetVehicleMod(vehicle, 36, props.modSpeakers, false)
end
if props.modTrunk then
SetVehicleMod(vehicle, 37, props.modTrunk, false)
end
if props.modHydrolic then
SetVehicleMod(vehicle, 38, props.modHydrolic, false)
end
if props.modEngineBlock then
SetVehicleMod(vehicle, 39, props.modEngineBlock, false)
end
if props.modAirFilter then
SetVehicleMod(vehicle, 40, props.modAirFilter, false)
end
if props.modStruts then
SetVehicleMod(vehicle, 41, props.modStruts, false)
end
if props.modArchCover then
SetVehicleMod(vehicle, 42, props.modArchCover, false)
end
if props.modAerials then
SetVehicleMod(vehicle, 43, props.modAerials, false)
end
if props.modTrimB then
SetVehicleMod(vehicle, 44, props.modTrimB, false)
end
if props.modTank then
SetVehicleMod(vehicle, 45, props.modTank, false)
end
if props.modWindows then
SetVehicleMod(vehicle, 46, props.modWindows, false)
end
if props.neonColor ~= nil then
SetVehicleNeonLightsColour(vehicle, props.neonColor[1], props.neonColor[2], props.neonColor[3])
end
if props.xenonColor ~= nil then
SetVehicleXenonLightsColor(vehicle, props.xenonColor)
end
if props.customXenonColor ~= nil then
SetVehicleXenonLightsCustomColor(vehicle, props.customXenonColor[1], props.customXenonColor[2],
props.customXenonColor[3])
end
if props.modSmokeEnabled ~= nil then
ToggleVehicleMod(vehicle, 20, true)
end
if props.tyreSmokeColor ~= nil then
SetVehicleTyreSmokeColor(vehicle, props.tyreSmokeColor[1], props.tyreSmokeColor[2], props.tyreSmokeColor[3])
end
if props.modSpoilers ~= nil then
SetVehicleMod(vehicle, 0, props.modSpoilers, false)
end
if props.modFrontBumper ~= nil then
SetVehicleMod(vehicle, 1, props.modFrontBumper, false)
end
if props.modRearBumper ~= nil then
SetVehicleMod(vehicle, 2, props.modRearBumper, false)
end
if props.modSideSkirt ~= nil then
SetVehicleMod(vehicle, 3, props.modSideSkirt, false)
end
if props.modExhaust ~= nil then
SetVehicleMod(vehicle, 4, props.modExhaust, false)
end
if props.modFrame ~= nil then
SetVehicleMod(vehicle, 5, props.modFrame, false)
end
if props.modGrille ~= nil then
SetVehicleMod(vehicle, 6, props.modGrille, false)
end
if props.modHood ~= nil then
SetVehicleMod(vehicle, 7, props.modHood, false)
end
if props.modFender ~= nil then
SetVehicleMod(vehicle, 8, props.modFender, false)
end
if props.modRightFender ~= nil then
SetVehicleMod(vehicle, 9, props.modRightFender, false)
end
if props.modRoof ~= nil then
SetVehicleMod(vehicle, 10, props.modRoof, false)
end
if props.modEngine ~= nil then
SetVehicleMod(vehicle, 11, props.modEngine, false)
end
if props.modBrakes ~= nil then
SetVehicleMod(vehicle, 12, props.modBrakes, false)
end
if props.modTransmission ~= nil then
SetVehicleMod(vehicle, 13, props.modTransmission, false)
end
if props.modHorns ~= nil then
SetVehicleMod(vehicle, 14, props.modHorns, false)
end
if props.modSuspension ~= nil then
SetVehicleMod(vehicle, 15, props.modSuspension, false)
end
if props.modArmor ~= nil then
SetVehicleMod(vehicle, 16, props.modArmor, false)
end
if props.modTurbo ~= nil then
ToggleVehicleMod(vehicle, 18, props.modTurbo)
end
if props.modXenon ~= nil then
ToggleVehicleMod(vehicle, 22, props.modXenon)
end
if props.modFrontWheels ~= nil then
SetVehicleMod(vehicle, 23, props.modFrontWheels, false)
end
if props.modBackWheels ~= nil then
SetVehicleMod(vehicle, 24, props.modBackWheels, false)
end
if props.modPlateHolder ~= nil then
SetVehicleMod(vehicle, 25, props.modPlateHolder, false)
end
if props.modVanityPlate ~= nil then
SetVehicleMod(vehicle, 26, props.modVanityPlate, false)
end
if props.modTrimA ~= nil then
SetVehicleMod(vehicle, 27, props.modTrimA, false)
end
if props.modOrnaments ~= nil then
SetVehicleMod(vehicle, 28, props.modOrnaments, false)
end
if props.modDashboard ~= nil then
SetVehicleMod(vehicle, 29, props.modDashboard, false)
end
if props.modDial ~= nil then
SetVehicleMod(vehicle, 30, props.modDial, false)
end
if props.modDoorSpeaker ~= nil then
SetVehicleMod(vehicle, 31, props.modDoorSpeaker, false)
end
if props.modSeats ~= nil then
SetVehicleMod(vehicle, 32, props.modSeats, false)
end
if props.modSteeringWheel ~= nil then
SetVehicleMod(vehicle, 33, props.modSteeringWheel, false)
end
if props.modShifterLeavers ~= nil then
SetVehicleMod(vehicle, 34, props.modShifterLeavers, false)
end
if props.modAPlate ~= nil then
SetVehicleMod(vehicle, 35, props.modAPlate, false)
end
if props.modSpeakers ~= nil then
SetVehicleMod(vehicle, 36, props.modSpeakers, false)
end
if props.modTrunk ~= nil then
SetVehicleMod(vehicle, 37, props.modTrunk, false)
end
if props.modHydrolic ~= nil then
SetVehicleMod(vehicle, 38, props.modHydrolic, false)
end
if props.modEngineBlock ~= nil then
SetVehicleMod(vehicle, 39, props.modEngineBlock, false)
end
if props.modAirFilter ~= nil then
SetVehicleMod(vehicle, 40, props.modAirFilter, false)
end
if props.modStruts ~= nil then
SetVehicleMod(vehicle, 41, props.modStruts, false)
end
if props.modArchCover ~= nil then
SetVehicleMod(vehicle, 42, props.modArchCover, false)
end
if props.modAerials ~= nil then
SetVehicleMod(vehicle, 43, props.modAerials, false)
end
if props.modTrimB ~= nil then
SetVehicleMod(vehicle, 44, props.modTrimB, false)
end
if props.modTank ~= nil then
SetVehicleMod(vehicle, 45, props.modTank, false)
end
if props.modWindows ~= nil then
SetVehicleMod(vehicle, 46, props.modWindows, false)
end
if props.modLivery then
SetVehicleMod(vehicle, 48, props.modLivery, false)
SetVehicleLivery(vehicle, props.modLivery)
end
if props.modLivery ~= nil then
SetVehicleMod(vehicle, 48, props.modLivery, false)
SetVehicleLivery(vehicle, props.modLivery)
end
if props.windowsBroken then
for k, v in pairs(props.windowsBroken) do
if v then
SmashVehicleWindow(vehicle, tonumber(k))
if props.windowsBroken ~= nil then
for k, v in pairs(props.windowsBroken) do
if v then
SmashVehicleWindow(vehicle, tonumber(k))
end
end
end
end
if props.doorsBroken then
for k, v in pairs(props.doorsBroken) do
if v then
SetVehicleDoorBroken(vehicle, tonumber(k), true)
if props.doorsBroken ~= nil then
for k, v in pairs(props.doorsBroken) do
if v then
SetVehicleDoorBroken(vehicle, tonumber(k), true)
end
end
end
end
if props.tyreBurst then
for k, v in pairs(props.tyreBurst) do
if v then
SetVehicleTyreBurst(vehicle, tonumber(k), true, 1000.0)
if props.tyreBurst ~= nil then
for k, v in pairs(props.tyreBurst) do
if v then
SetVehicleTyreBurst(vehicle, tonumber(k), true, 1000.0)
end
end
end
end
+18 -45
View File
@@ -17,7 +17,7 @@ RegisterNetEvent('esx_identity:setPlayerData', function(data)
ESX.SetPlayerData('sex', data.sex)
ESX.SetPlayerData('height', data.height)
end)
end)
end)
AddEventHandler('esx:loadingScreenOff', function()
loadingScreenFinished = true
@@ -29,7 +29,7 @@ RegisterNUICallback('ready', function(data, cb)
end)
if not Config.UseDeferrals then
function EnableGui(state)
function setGuiState(state)
SetNuiFocus(state, state)
guiEnabled = state
@@ -39,58 +39,31 @@ if not Config.UseDeferrals then
ClearTimecycleModifier()
end
SendNUIMessage({type = "enableui",enable = state})
SendNUIMessage({type = "enableui", enable = state})
end
RegisterNetEvent('esx_identity:showRegisterIdentity', function()
TriggerEvent('esx_skin:resetFirstSpawn')
if not ESX.PlayerData.dead then EnableGui(true) end
if not ESX.PlayerData.dead then setGuiState(true) end
end)
RegisterNUICallback('register', function(data, cb)
ESX.TriggerServerCallback('esx_identity:registerIdentity', function(callback)
if callback then
ESX.ShowNotification(TranslateCap('thank_you_for_registering'))
EnableGui(false)
if not guiEnabled then
return
end
if not ESX.GetConfig().Multichar then
TriggerEvent('esx_skin:playerRegistered')
end
ESX.TriggerServerCallback('esx_identity:registerIdentity', function(callback)
if not callback then
return
end
ESX.ShowNotification(TranslateCap('thank_you_for_registering'))
setGuiState(false)
if not ESX.GetConfig().Multichar then
TriggerEvent('esx_skin:playerRegistered')
end
end, data)
end)
CreateThread(function()
while true do
local sleep = 1500
if guiEnabled then
sleep = 0
DisableControlAction(0, 1, true) -- LookLeftRight
DisableControlAction(0, 2, true) -- LookUpDown
DisableControlAction(0, 106, true) -- VehicleMouseControlOverride
DisableControlAction(0, 142, true) -- MeleeAttackAlternate
DisableControlAction(0, 30, true) -- MoveLeftRight
DisableControlAction(0, 31, true) -- MoveUpDown
DisableControlAction(0, 21, true) -- disable sprint
DisableControlAction(0, 24, true) -- disable attack
DisableControlAction(0, 25, true) -- disable aim
DisableControlAction(0, 47, true) -- disable weapon
DisableControlAction(0, 58, true) -- disable weapon
DisableControlAction(0, 263, true) -- disable melee
DisableControlAction(0, 264, true) -- disable melee
DisableControlAction(0, 257, true) -- disable melee
DisableControlAction(0, 140, true) -- disable melee
DisableControlAction(0, 141, true) -- disable melee
DisableControlAction(0, 143, true) -- disable melee
DisableControlAction(0, 75, true) -- disable exit vehicle
DisableControlAction(27, 75, true) -- disable exit vehicle
else
sleep = 1500
end
Wait(sleep)
end
end)
end
end
+17 -18
View File
@@ -1,38 +1,37 @@
$(document).ready(function () {
$.post("http://esx_identity/ready", JSON.stringify({}));
$.post('http://esx_identity/ready', JSON.stringify({}));
window.addEventListener("message", function (event) {
if (event.data.type === "enableui") {
window.addEventListener('message', function (event) {
if (event.data.type === 'enableui') {
event.data.enable ? $(document.body).show() : $(document.body).hide();
}
});
$("#register").submit(function (event) {
$('#register').submit(function (event) {
event.preventDefault();
const dateCheck = new Date($("#dateofbirth").val());
const dofVal = $('#dateofbirth').val();
if (!dofVal) return;
const year = new Intl.DateTimeFormat("en", { year: "numeric" }).format(
dateCheck
);
const month = new Intl.DateTimeFormat("en", { month: "2-digit" }).format(
dateCheck
);
const day = new Intl.DateTimeFormat("en", { day: "2-digit" }).format(
dateCheck
);
const dateCheck = new Date(dofVal);
const year = new Intl.DateTimeFormat('en', { year: 'numeric' }).format(dateCheck);
const month = new Intl.DateTimeFormat('en', { month: '2-digit' }).format(dateCheck);
const day = new Intl.DateTimeFormat('en', { day: '2-digit' }).format(dateCheck);
const formattedDate = `${day}/${month}/${year}`;
$.post(
"http://esx_identity/register",
'http://esx_identity/register',
JSON.stringify({
firstname: $("#firstname").val(),
lastname: $("#lastname").val(),
firstname: $('#firstname').val(),
lastname: $('#lastname').val(),
dateofbirth: formattedDate,
sex: $("input[type='radio'][name='sex']:checked").val(),
height: $("#height").val(),
height: $('#height').val(),
})
);
$('#register').trigger('reset');
});
});
+230 -310
View File
@@ -17,15 +17,17 @@ local function deleteIdentityFromDatabase(xPlayer)
end
local function deleteIdentity(xPlayer)
if alreadyRegistered[xPlayer.identifier] then
xPlayer.setName(('%s %s'):format(nil, nil))
xPlayer.set('firstName', nil)
xPlayer.set('lastName', nil)
xPlayer.set('dateofbirth', nil)
xPlayer.set('sex', nil)
xPlayer.set('height', nil)
deleteIdentityFromDatabase(xPlayer)
if not alreadyRegistered[xPlayer.identifier] then
return
end
xPlayer.setName(('%s %s'):format(nil, nil))
xPlayer.set('firstName', nil)
xPlayer.set('lastName', nil)
xPlayer.set('dateofbirth', nil)
xPlayer.set('sex', nil)
xPlayer.set('height', nil)
deleteIdentityFromDatabase(xPlayer)
end
local function saveIdentityToDatabase(identifier, identity)
@@ -34,45 +36,30 @@ local function saveIdentityToDatabase(identifier, identity)
{identity.firstName, identity.lastName, identity.dateOfBirth, identity.sex, identity.height, identifier})
end
local function checkDate(str)
if string.match(str, '(%d%d)/(%d%d)/(%d%d%d%d)') ~= nil then
local d, m, y = string.match(str, '(%d+)/(%d+)/(%d+)')
local function checkDOBFormat(str)
str = tostring(str)
if not string.match(str, '(%d%d)/(%d%d)/(%d%d%d%d)') then
return false
end
local d, m, y = string.match(str, '(%d+)/(%d+)/(%d+)')
m = tonumber(m)
d = tonumber(d)
y = tonumber(y)
m = tonumber(m)
d = tonumber(d)
y = tonumber(y)
if ((d <= 0) or (d > 31)) or ((m <= 0) or (m > 12)) or ((y <= Config.LowestYear) or (y > Config.HighestYear)) then
return false
elseif m == 4 or m == 6 or m == 9 or m == 11 then
if d > 30 then
return false
else
return true
end
elseif m == 2 then
if y % 400 == 0 or (y % 100 ~= 0 and y % 4 == 0) then
if d > 29 then
return false
else
return true
end
else
if d > 28 then
return false
else
return true
end
end
if ((d <= 0) or (d > 31)) or ((m <= 0) or (m > 12)) or ((y <= Config.LowestYear) or (y > Config.HighestYear)) then
return false
elseif m == 4 or m == 6 or m == 9 or m == 11 then
return d < 30
elseif m == 2 then
if y % 400 == 0 or (y % 100 ~= 0 and y % 4 == 0) then
return d < 29
else
if d > 31 then
return false
else
return true
end
return d < 28
end
else
return false
return d < 31
end
end
@@ -98,47 +85,24 @@ local function checkForNumbers(str)
end
local function checkNameFormat(name)
if not checkAlphanumeric(name) then
if not checkForNumbers(name) then
local stringLength = string.len(name)
if stringLength > 0 and stringLength < Config.MaxNameLength then
return true
else
return false
end
else
return false
end
else
return false
if not checkAlphanumeric(name) and not checkForNumbers(name) then
local stringLength = string.len(name)
return stringLength > 0 and stringLength < Config.MaxNameLength
end
end
local function checkDOBFormat(dob)
local date = tostring(dob)
if checkDate(date) then
return true
else
return false
end
return false
end
local function checkSexFormat(sex)
if sex == "m" or sex == "M" or sex == "f" or sex == "F" then
return true
else
if not sex then
return false
end
return sex == "m" or sex == "M" or sex == "f" or sex == "F"
end
local function checkHeightFormat(height)
local numHeight = tonumber(height)
if numHeight < Config.MinHeight and numHeight > Config.MaxHeight then
return false
else
return true
end
local numHeight = tonumber(height) or 0
return numHeight >= Config.MinHeight and numHeight <= Config.MaxHeight
end
local function convertToLowerCase(str)
@@ -151,8 +115,7 @@ end
local function formatName(name)
local loweredName = convertToLowerCase(name)
local formattedName = convertFirstLetterToUpper(loweredName)
return formattedName
return convertFirstLetterToUpper(loweredName)
end
if Config.UseDeferrals then
@@ -187,7 +150,7 @@ if Config.UseDeferrals then
{"title":"Female","value":"f"}],"style":"expanded","id":"sex"}]},{"type": "ActionSet",
"actions": [{"type":"Action.Submit","title":"Submit"}]}],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json","version":"1.0"}]==],
function(data, rawData)
function(data)
if data.firstname == '' or data.lastname == '' or data.dateofbirth == '' or data.sex ==
'' or data.height == '' then
deferrals.done(TranslateCap('data_incorrect'))
@@ -222,46 +185,36 @@ if Config.UseDeferrals then
"placeholder":"Sex","choices":[{"title":"Male","value":"m"},{"title":"Female","value":"f"}],
"style":"expanded","id":"sex"}]},{"type": "ActionSet","actions": [{"type":"Action.Submit",
"title":"Submit"}]}],"$schema": "http://adaptivecards.io/schemas/adaptive-card.json","version":"1.0"}]==],
function(data, rawData)
if data.firstname == '' or data.lastname == '' or data.dateofbirth == '' or data.sex ==
'' or data.height == '' then
deferrals.done(TranslateCap('data_incorrect'))
else
if checkNameFormat(data.firstname) then
if checkNameFormat(data.lastname) then
if checkDOBFormat(data.dateofbirth) then
if checkSexFormat(data.sex) then
if checkHeightFormat(data.height) then
local formattedFirstName = formatName(data.firstname)
local formattedLastName = formatName(data.lastname)
local formattedDate = formatDate(data.dateofbirth)
playerIdentity[identifier] = {
firstName = formatName(data.firstname),
lastName = formatName(data.lastname),
dateOfBirth = data.dateofbirth,
sex = data.sex,
height = tonumber(data.height),
saveToDatabase = true
}
deferrals.done()
else
deferrals.done(TranslateCap('invalid_height_format'))
end
else
deferrals.done(TranslateCap('invalid_sex_format'))
end
else
deferrals.done(TranslateCap('invalid_dob_format'))
end
else
deferrals.done(TranslateCap('invalid_lastname_format'))
end
else
deferrals.done(TranslateCap('invalid_firstname_format'))
end
function(data)
if data.firstname == '' or data.lastname == '' or data.dateofbirth == '' or data.sex == '' or data.height == '' then
return deferrals.done(TranslateCap('data_incorrect'))
end
if not checkNameFormat(data.firstname) then
return deferrals.done(TranslateCap('invalid_firstname_format'))
end
if not checkNameFormat(data.lastname) then
return deferrals.done(TranslateCap('invalid_lastname_format'))
end
if not checkDOBFormat(data.dateofbirth) then
return deferrals.done(TranslateCap('invalid_dob_format'))
end
if not checkSexFormat(data.sex) then
return deferrals.done(TranslateCap('invalid_sex_format'))
end
if not checkHeightFormat(data.height) then
return deferrals.done(TranslateCap('invalid_height_format'))
end
playerIdentity[identifier] = {
firstName = formatName(data.firstname),
lastName = formatName(data.lastname),
dateOfBirth = formatDate(data.dateofbirth),
sex = data.sex,
height = tonumber(data.height),
saveToDatabase = true
}
deferrals.done()
end)
end
end)
@@ -272,70 +225,71 @@ if Config.UseDeferrals then
RegisterNetEvent('esx:playerLoaded')
AddEventHandler('esx:playerLoaded', function(playerId, xPlayer)
if playerIdentity[xPlayer.identifier] then
local currentIdentity = playerIdentity[xPlayer.identifier]
xPlayer.setName(('%s %s'):format(currentIdentity.firstName, currentIdentity.lastName))
xPlayer.set('firstName', currentIdentity.firstName)
xPlayer.set('lastName', currentIdentity.lastName)
xPlayer.set('dateofbirth', currentIdentity.dateOfBirth)
xPlayer.set('sex', currentIdentity.sex)
xPlayer.set('height', currentIdentity.height)
if currentIdentity.saveToDatabase then
saveIdentityToDatabase(xPlayer.identifier, currentIdentity)
end
Wait(0)
alreadyRegistered[xPlayer.identifier] = true
TriggerClientEvent('esx_identity:alreadyRegistered', xPlayer.source)
playerIdentity[xPlayer.identifier] = nil
else
xPlayer.kick(_('missing_identity'))
if not playerIdentity[xPlayer.identifier] then
return xPlayer.kick(_('missing_identity'))
end
local currentIdentity = playerIdentity[xPlayer.identifier]
xPlayer.setName(('%s %s'):format(currentIdentity.firstName, currentIdentity.lastName))
xPlayer.set('firstName', currentIdentity.firstName)
xPlayer.set('lastName', currentIdentity.lastName)
xPlayer.set('dateofbirth', currentIdentity.dateOfBirth)
xPlayer.set('sex', currentIdentity.sex)
xPlayer.set('height', currentIdentity.height)
if currentIdentity.saveToDatabase then
saveIdentityToDatabase(xPlayer.identifier, currentIdentity)
end
Wait(0)
alreadyRegistered[xPlayer.identifier] = true
TriggerClientEvent('esx_identity:alreadyRegistered', xPlayer.source)
playerIdentity[xPlayer.identifier] = nil
end)
else
local function setIdentity(xPlayer)
if alreadyRegistered[xPlayer.identifier] then
local currentIdentity = playerIdentity[xPlayer.identifier]
if not alreadyRegistered[xPlayer.identifier] then
return
end
local currentIdentity = playerIdentity[xPlayer.identifier]
xPlayer.setName(('%s %s'):format(currentIdentity.firstName, currentIdentity.lastName))
xPlayer.set('firstName', currentIdentity.firstName)
xPlayer.set('lastName', currentIdentity.lastName)
xPlayer.set('dateofbirth', currentIdentity.dateOfBirth)
xPlayer.set('sex', currentIdentity.sex)
xPlayer.set('height', currentIdentity.height)
TriggerClientEvent('esx_identity:setPlayerData', xPlayer.source, currentIdentity)
if currentIdentity.saveToDatabase then
saveIdentityToDatabase(xPlayer.identifier, currentIdentity)
end
xPlayer.setName(('%s %s'):format(currentIdentity.firstName, currentIdentity.lastName))
xPlayer.set('firstName', currentIdentity.firstName)
xPlayer.set('lastName', currentIdentity.lastName)
xPlayer.set('dateofbirth', currentIdentity.dateOfBirth)
xPlayer.set('sex', currentIdentity.sex)
xPlayer.set('height', currentIdentity.height)
TriggerClientEvent('esx_identity:setPlayerData', xPlayer.source, currentIdentity)
if currentIdentity.saveToDatabase then
saveIdentityToDatabase(xPlayer.identifier, currentIdentity)
end
playerIdentity[xPlayer.identifier] = nil
end
playerIdentity[xPlayer.identifier] = nil
end
local function checkIdentity(xPlayer)
MySQL.single('SELECT firstname, lastname, dateofbirth, sex, height FROM users WHERE identifier = ?',
{xPlayer.identifier}, function(result)
if result then
if result.firstname then
playerIdentity[xPlayer.identifier] = {
firstName = result.firstname,
lastName = result.lastname,
dateOfBirth = result.dateofbirth,
sex = result.sex,
height = result.height
}
alreadyRegistered[xPlayer.identifier] = true
setIdentity(xPlayer)
else
playerIdentity[xPlayer.identifier] = nil
alreadyRegistered[xPlayer.identifier] = false
TriggerClientEvent('esx_identity:showRegisterIdentity', xPlayer.source)
end
else
TriggerClientEvent('esx_identity:showRegisterIdentity', xPlayer.source)
MySQL.single('SELECT firstname, lastname, dateofbirth, sex, height FROM users WHERE identifier = ?', {xPlayer.identifier},
function(result)
if not result then
return TriggerClientEvent('esx_identity:showRegisterIdentity', xPlayer.source)
end
end)
if not result.firstname then
playerIdentity[xPlayer.identifier] = nil
alreadyRegistered[xPlayer.identifier] = false
return TriggerClientEvent('esx_identity:showRegisterIdentity', xPlayer.source)
end
playerIdentity[xPlayer.identifier] = {
firstName = result.firstname,
lastName = result.lastname,
dateOfBirth = result.dateofbirth,
sex = result.sex,
height = result.height
}
alreadyRegistered[xPlayer.identifier] = true
setIdentity(xPlayer)
end
)
end
if not multichar then
@@ -344,50 +298,49 @@ else
local playerId, identifier = source, ESX.GetIdentifier(source)
Wait(40)
if identifier then
MySQL.single('SELECT firstname, lastname, dateofbirth, sex, height FROM users WHERE identifier = ?',
{identifier}, function(result)
if result then
if result.firstname then
playerIdentity[identifier] = {
firstName = result.firstname,
lastName = result.lastname,
dateOfBirth = result.dateofbirth,
sex = result.sex,
height = result.height
}
if not identifier then
return deferrals.done(TranslateCap('no_identifier'))
end
MySQL.single('SELECT firstname, lastname, dateofbirth, sex, height FROM users WHERE identifier = ?', {identifier},
function(result)
if not result then
playerIdentity[identifier] = nil
alreadyRegistered[identifier] = false
return deferrals.done()
end
if not result.firstname then
playerIdentity[identifier] = nil
alreadyRegistered[identifier] = false
return deferrals.done()
end
alreadyRegistered[identifier] = true
playerIdentity[identifier] = {
firstName = result.firstname,
lastName = result.lastname,
dateOfBirth = result.dateofbirth,
sex = result.sex,
height = result.height
}
deferrals.done()
else
playerIdentity[identifier] = nil
alreadyRegistered[identifier] = false
deferrals.done()
end
else
playerIdentity[identifier] = nil
alreadyRegistered[identifier] = false
deferrals.done()
end
end)
else
deferrals.done(TranslateCap('no_identifier'))
end
alreadyRegistered[identifier] = true
deferrals.done()
end)
end)
AddEventHandler('onResourceStart', function(resource)
if resource == GetCurrentResourceName() then
Wait(300)
if resource ~= GetCurrentResourceName() then
return
end
Wait(300)
while not ESX do Wait(0) end
while not ESX do Wait(0) end
local xPlayers = ESX.GetExtendedPlayers()
local xPlayers = ESX.GetExtendedPlayers()
for i=1, #(xPlayers) do
if xPlayers[i] then
checkIdentity(xPlayers[i])
end
for i=1, #(xPlayers) do
if xPlayers[i] then
checkIdentity(xPlayers[i])
end
end
end)
@@ -395,7 +348,7 @@ else
RegisterNetEvent('esx:playerLoaded', function(playerId, xPlayer)
local currentIdentity = playerIdentity[xPlayer.identifier]
if currentIdentity and alreadyRegistered[xPlayer.identifier] == true then
if currentIdentity and alreadyRegistered[xPlayer.identifier] then
xPlayer.setName(('%s %s'):format(currentIdentity.firstName, currentIdentity.lastName))
xPlayer.set('firstName', currentIdentity.firstName)
xPlayer.set('lastName', currentIdentity.lastName)
@@ -421,112 +374,79 @@ else
ESX.RegisterServerCallback('esx_identity:registerIdentity', function(source, cb, data)
local xPlayer = ESX.GetPlayerFromId(source)
if not checkNameFormat(data.firstname) then
xPlayer.showNotification(TranslateCap('invalid_firstname_format'), "error")
return cb(false)
end
if not checkNameFormat(data.lastname) then
xPlayer.showNotification(TranslateCap('invalid_lastname_format'), "error")
return cb(false)
end
if not checkSexFormat(data.sex) then
xPlayer.showNotification(TranslateCap('invalid_sex_format'), "error")
return cb(false)
end
if not checkDOBFormat(data.dateofbirth) then
xPlayer.showNotification(TranslateCap('invalid_dob_format'), "error")
return cb(false)
end
if not checkHeightFormat(data.height) then
xPlayer.showNotification(TranslateCap('invalid_height_format'), "error")
return cb(false)
end
if xPlayer then
if not alreadyRegistered[xPlayer.identifier] then
xPlayer.showNotification(TranslateCap('running'), "error")
if checkNameFormat(data.firstname) then
if checkNameFormat(data.lastname) then
if checkSexFormat(data.sex) then
if checkDOBFormat(data.dateofbirth) then
if checkHeightFormat(data.height) then
local formattedFirstName = formatName(data.firstname)
local formattedLastName = formatName(data.lastname)
local formattedDate = formatDate(data.dateofbirth)
playerIdentity[xPlayer.identifier] = {
firstName = formattedFirstName,
lastName = formattedLastName,
dateOfBirth = formattedDate,
sex = data.sex,
height = data.height
}
local currentIdentity = playerIdentity[xPlayer.identifier]
xPlayer.setName(('%s %s'):format(currentIdentity.firstName, currentIdentity.lastName))
xPlayer.set('firstName', currentIdentity.firstName)
xPlayer.set('lastName', currentIdentity.lastName)
xPlayer.set('dateofbirth', currentIdentity.dateOfBirth)
xPlayer.set('sex', currentIdentity.sex)
xPlayer.set('height', currentIdentity.height)
TriggerClientEvent('esx_identity:setPlayerData', xPlayer.source, currentIdentity)
saveIdentityToDatabase(xPlayer.identifier, currentIdentity)
alreadyRegistered[xPlayer.identifier] = true
playerIdentity[xPlayer.identifier] = nil
cb(true)
else
xPlayer.showNotification(TranslateCap('invalid_height_format'), "error")
cb(false)
end
else
xPlayer.showNotification(TranslateCap('invalid_dob_format'), "error")
cb(false)
end
else
xPlayer.showNotification(TranslateCap('invalid_sex_format'), "error")
cb(false)
end
else
xPlayer.showNotification(TranslateCap('invalid_lastname_format'), "error")
cb(false)
end
else
xPlayer.showNotification(TranslateCap('invalid_firstname_format'), "error")
cb(false)
end
else
if alreadyRegistered[xPlayer.identifier] then
xPlayer.showNotification(TranslateCap('already_registered'), "error")
cb(false)
end
else
if multichar then
if checkNameFormat(data.firstname) then
if checkNameFormat(data.lastname) then
if checkSexFormat(data.sex) then
if checkDOBFormat(data.dateofbirth) then
local formattedFirstName = formatName(data.firstname)
local formattedLastName = formatName(data.lastname)
local formattedDate = formatDate(data.dateofbirth)
data.firstname = formattedFirstName
data.lastname = formattedLastName
data.dateofbirth = formattedDate
if checkHeightFormat(data.height) then
local Identity= {
firstName = formattedFirstName,
lastName = formattedLastName,
dateOfBirth = formattedDate,
sex = data.sex,
height = data.height
}
TriggerEvent('esx_identity:completedRegistration', source, data)
TriggerClientEvent('esx_identity:setPlayerData', source, Identity)
cb(true)
else
TriggerClientEvent("esx:showNotification", source, TranslateCap('invalid_height_format'), "error")
cb(false)
end
else
TriggerClientEvent("esx:showNotification", source, TranslateCap('invalid_dob_format'), "error")
cb(false)
end
else
TriggerClientEvent("esx:showNotification", source, TranslateCap('invalid_sex_format'), "error")
cb(false)
end
else
TriggerClientEvent("esx:showNotification", source, TranslateCap('invalid_lastname_format'), "error")
cb(false)
end
else
TriggerClientEvent("esx:showNotification", source, TranslateCap('invalid_firstname_format'), "error")
cb(false)
end
else
TriggerClientEvent("esx:showNotification", source, TranslateCap('data_incorrect'), "error")
cb(false)
end
end
return cb(false)
end
playerIdentity[xPlayer.identifier] = {
firstName = formatName(data.firstname),
lastName = formatName(data.lastname),
dateOfBirth = formatDate(data.dateofbirth),
sex = data.sex,
height = data.height
}
local currentIdentity = playerIdentity[xPlayer.identifier]
xPlayer.setName(('%s %s'):format(currentIdentity.firstName, currentIdentity.lastName))
xPlayer.set('firstName', currentIdentity.firstName)
xPlayer.set('lastName', currentIdentity.lastName)
xPlayer.set('dateofbirth', currentIdentity.dateOfBirth)
xPlayer.set('sex', currentIdentity.sex)
xPlayer.set('height', currentIdentity.height)
TriggerClientEvent('esx_identity:setPlayerData', xPlayer.source, currentIdentity)
saveIdentityToDatabase(xPlayer.identifier, currentIdentity)
alreadyRegistered[xPlayer.identifier] = true
playerIdentity[xPlayer.identifier] = nil
return cb(true)
end
if not multichar then
TriggerClientEvent("esx:showNotification", source, TranslateCap('data_incorrect'), "error")
return cb(false)
end
local formattedFirstName = formatName(data.firstname)
local formattedLastName = formatName(data.lastname)
local formattedDate = formatDate(data.dateofbirth)
data.firstname = formattedFirstName
data.lastname = formattedLastName
data.dateofbirth = formattedDate
local Identity = {
firstName = formattedFirstName,
lastName = formattedLastName,
dateOfBirth = formattedDate,
sex = data.sex,
height = data.height
}
TriggerEvent('esx_identity:completedRegistration', source, data)
TriggerClientEvent('esx_identity:setPlayerData', source, Identity)
cb(true)
end)
end
+8 -8
View File
@@ -110,7 +110,7 @@ if ESX.GetConfig().Multichar then
if Characters[index] then
local skin = Characters[index].skin or Config.Default
if not Characters[index].model then
if Characters[index].sex == _('female') then skin.sex = 1 else skin.sex = 0 end
if Characters[index].sex == TranslateCap('female') then skin.sex = 1 else skin.sex = 0 end
end
TriggerEvent('skinchanger:loadSkin', skin)
end
@@ -142,14 +142,14 @@ if ESX.GetConfig().Multichar then
end
function CharacterOptions(Characters, slots, SelectedCharacter)
local elements = {{title = "Character: ".. Characters[SelectedCharacter.value].firstname .. " ".. Characters[SelectedCharacter.value].lastname,icon = "fa-regular fa-user", unselectable = true},
{title = "Return", unselectable = false,icon = "fa-solid fa-arrow-left",description ="Return To Character Selection.", action = "return"}}
local elements = {{title = TranslateCap('character', Characters[SelectedCharacter.value].firstname .. " ".. Characters[SelectedCharacter.value].lastname),icon = "fa-regular fa-user", unselectable = true},
{title = TranslateCap('return'), unselectable = false,icon = "fa-solid fa-arrow-left",description = TranslateCap('return_description'), action = "return"}}
if not Characters[SelectedCharacter.value].disabled then
elements[3] = {title = _('char_play'), description ="Continue Into The City.", icon ="fa-solid fa-play",action = 'play', value = SelectedCharacter.value}
elements[3] = {title = TranslateCap('char_play'), description = TranslateCap('char_play_description'), icon ="fa-solid fa-play",action = 'play', value = SelectedCharacter.value}
else
elements[3] = {title = _('char_disabled'), value = SelectedCharacter.value, icon ="fa-solid fa-xmark", description ="This Character Is Unusable.",}
elements[3] = {title = TranslateCap('char_disabled'), value = SelectedCharacter.value, icon ="fa-solid fa-xmark", description = TranslateCap('char_disabled_description'),}
end
if Config.CanDelete then elements[4] = {title = _('char_delete'),icon ="fa-solid fa-xmark",description ="Permanently Remove This Character.", action = 'delete', value = SelectedCharacter.value} end
if Config.CanDelete then elements[4] = {title = TranslateCap('char_delete'),icon ="fa-solid fa-xmark",description = TranslateCap('char_delete_description'), action = 'delete', value = SelectedCharacter.value} end
ESX.OpenContext("left", elements, function(element, Action)
if Action.action == "play" then
SendNUIMessage({
@@ -169,7 +169,7 @@ if ESX.GetConfig().Multichar then
function SelectCharacterMenu(Characters, slots)
local Character = next(Characters)
local elements = {{title = _('select_char') , icon = "fa-solid fa-users", description = _('select_char_description') , unselectable = true}}
local elements = {{title = TranslateCap('select_char') , icon = "fa-solid fa-users", description = TranslateCap('select_char_description') , unselectable = true}}
for k,v in pairs(Characters) do
if not v.model and v.skin then
if v.skin.model then v.model = v.skin.model elseif v.skin.sex == 1 then v.model = mp_f_freemode_01 else v.model = mp_m_freemode_01 end
@@ -183,7 +183,7 @@ if ESX.GetConfig().Multichar then
end
end
if #elements - 1 < slots then
elements[#elements+1] = {title = _('create_char'), icon = "fa-solid fa-plus", value = (#elements+1), new = true}
elements[#elements+1] = {title = TranslateCap('create_char'), icon = "fa-solid fa-plus", value = (#elements+1), new = true}
end
ESX.OpenContext("left", elements, function(menu, SelectedCharacter)
+14 -11
View File
@@ -1,26 +1,29 @@
Locales['cs'] = {
['male'] = "Muž",
['female'] = "Žena",
['delete_label'] = "Vymazat %s %s?",
["male"] = "Muž",
["female"] = "Žena",
['select_char'] = "Zvolit Postavu",
["select_char_description"] = "Select a character to play as.",
["select_char_description"] = "Zvol si postavu za kterou budeš hrát.",
['create_char'] = "Vytvořit Novou Postavu",
['char_play'] = "Hrát za postavu",
["char_play_description"] = "Pokračovat do města.",
['char_disabled'] = "Tato postava je zakázána!",
["char_disabled_description"] = "Tuto postavu nemůžeš používat.",
['char_delete'] = "Vymazat postavu",
['cancel'] = "Zrušit",
['confirm'] = "Potvrdit",
['command_setslots'] = "Nastavit slot pro hráče v multicharacteru",
['command_remslots'] = "Odebrat slot pro hráče v multicharacteru",
['command_enablechar'] = "Povolit zovlený slot hráči",
['command_disablechar'] = "Zakázat zvolený slot pro hračé",
["char_delete_description"] = "Na vždy smazat tuto postavu.",
["character"] = "Postava: %s",
["return"] = "Zpět",
["return_description"] = "Vrátit se na vybírání postav.",
['command_setslots'] = "Nastavit sloty pro hráče v multicharacteru",
['command_remslots'] = "Odebrat sloty pro hráče v multicharacteru",
['command_enablechar'] = "Povolit zvolený slot hráči",
['command_disablechar'] = "Zakázat zvolený slot pro hrače",
['command_charslot'] = "Číslo slotu",
['command_identifier'] = "Identifier hráče",
['command_slots'] = "# ze slotu",
['slotsadd'] = "Přidal slot %s hráči %s",
['slotsedit'] = "Nastavil si slot %s hráči %s",
['slotsrem'] = "Odebral si slot %s",
['charenabled'] = "Povolol si postavu #%s z %s",
['charenabled'] = "Povolil si postavu #%s z %s",
['chardisabled'] = "Zakázal si postavu #%s z %s",
['charnotfound'] = "Postava #%s z %s nebyla nalezena/neexistuje",
}
+6 -3
View File
@@ -1,15 +1,18 @@
Locales["en"] = {
["male"] = "Male",
["female"] = "Female",
["delete_label"] = "Delete %s %s?",
["select_char"] = "Select Character",
["select_char_description"] = "Select a character to play as.",
["create_char"] = "New Character",
["char_play"] = "Play",
["char_play_description"] = "Continue Into The City.",
["char_disabled"] = "Disabled",
["char_disabled_description"] = "This Character Is Unusable.",
["char_delete"] = "Delete",
["cancel"] = "Cancel",
["confirm"] = "Confirm",
["char_delete_description"] = "Permanently Remove This Character.",
["character"] = "Character: %s",
["return"] = "Return",
["return_description"] = "Return To Character Selection.",
["command_setslots"] = "Set multicharacter slots number of a player",
["command_remslots"] = "Remove multicharacter slots number of a player",
["command_enablechar"] = "Enable a given character of a player",
+1 -1
View File
@@ -81,7 +81,7 @@ elseif ESX.GetConfig().Multichar == true then
dateofbirth = v.dateofbirth,
skin = v.skin and json.decode(v.skin) or {},
disabled = v.disabled,
sex = v.sex == 'm' and _('male') or _('female')
sex = v.sex == 'm' and TranslateCap('male') or TranslateCap('female')
}
end
end
+1 -1
View File
@@ -5,7 +5,7 @@ Config.Visible = true
Config.Food = {
["bread"] = {
status = 200000,
remove = false
remove = true
}
}
+1 -1
View File
@@ -1,5 +1,5 @@
Locales['hu'] = {
['new_job'] = 'Felvetted a munkát!',
['access_job_center'] = 'Nyomj ~INPUT_PICKUP~ hogy megnézd a munkákat',
['access_job_center'] = 'Nyomj ~b~[E]~s~ hogy megnézd a munkákat',
['job_center'] = 'Munkaügyi központ',
}
+5
View File
@@ -0,0 +1,5 @@
Config = {}
Config.allowedJobs = {
['police'] = true
}
+1
View File
@@ -9,5 +9,6 @@ version '1.8.5'
server_scripts {
'@es_extended/imports.lua',
'@oxmysql/lib/MySQL.lua',
'config.lua',
'server/main.lua'
}
+113 -71
View File
@@ -1,113 +1,155 @@
function AddLicense(target, type, cb)
local xPlayer = ESX.GetPlayerFromId(target)
local licenses = {}
if xPlayer then
MySQL.insert('INSERT INTO user_licenses (type, owner) VALUES (?, ?)', {type, xPlayer.identifier},
function(rowsChanged)
if cb then
cb()
end
end)
else
MySQL.ready(function()
local p = promise.new()
MySQL.query('SELECT type, label FROM licenses', function(result)
licenses = result
p:resolve(true)
end)
Citizen.Await(p)
ESX.Trace('[esx_license] : ' .. #licenses .. ' Loaded.')
end)
---@param identifier target identifier
---@param licenseType license type
---@param cb callback function
local function AddLicense(identifier, licenseType, cb)
MySQL.insert('INSERT INTO user_licenses (type, owner) VALUES (?, ?)', {licenseType, identifier}, function(rowsChanged)
if cb then
cb()
cb(rowsChanged)
end
end
end
function RemoveLicense(target, type, cb)
local xPlayer = ESX.GetPlayerFromId(target)
if xPlayer then
MySQL.update('DELETE FROM user_licenses WHERE type = ? AND owner = ?', {type, xPlayer.identifier},
function(rowsChanged)
if cb then
cb()
end
end)
else
if cb then
cb()
end
end
end
function GetLicense(type, cb)
MySQL.scalar('SELECT label FROM licenses WHERE type = ?', {type},
function(result)
cb({type = type, label = result})
end)
end
function GetLicenses(target, cb)
local xPlayer = ESX.GetPlayerFromId(target)
MySQL.query('SELECT user_licenses.type, licenses.label FROM user_licenses LEFT JOIN licenses ON user_licenses.type = licenses.type WHERE owner = ?', {xPlayer.identifier},
function(result)
cb(result)
---@param identifier target identifier
---@param licenseType license type
---@param cb callback function
local function RemoveLicense(identifier, licenseType, cb)
MySQL.update('DELETE FROM user_licenses WHERE type = ? AND owner = ?', {licenseType, identifier}, function(rowsChanged)
if cb then
cb(rowsChanged)
end
end)
end
function CheckLicense(target, type, cb)
local xPlayer = ESX.GetPlayerFromId(target)
---@param licenseType license type
---@param cb callback function
local function GetLicense(licenseType, cb)
MySQL.scalar('SELECT label FROM licenses WHERE type = ?', {licenseType}, function(result)
if cb then
cb({type = licenseType, label = result})
end
end)
end
if xPlayer then
MySQL.scalar('SELECT type FROM user_licenses WHERE type = ? AND owner = ?', {type, xPlayer.identifier},
function(result)
---@param identifier target identifier
---@param cb callback function
local function GetLicenses(identifier, cb)
MySQL.query('SELECT user_licenses.type, licenses.label FROM user_licenses LEFT JOIN licenses ON user_licenses.type = licenses.type WHERE owner = ?', {identifier},
function(result)
if cb then
cb(result)
end
end)
end
---@param identifier target identifier
---@param licenseType license type
---@param cb callback function
local function CheckLicense(identifier, licenseType, cb)
MySQL.scalar('SELECT type FROM user_licenses WHERE type = ? AND owner = ?', {licenseType, identifier}, function(result)
if cb then
if result then
cb(true)
else
cb(false)
end
end)
else
cb(false)
end
end
function GetLicensesList(cb)
MySQL.query('SELECT type, label FROM licenses',
function(result)
cb(result)
end
end)
end
RegisterNetEvent('esx_license:addLicense')
AddEventHandler('esx_license:addLicense', function(target, type, cb)
AddLicense(target, type, cb)
local function GetLicensesList(cb)
cb(licenses)
end
local function isValidLicense(licenseType)
local flag = false
for i=1,#licenses do
if licenses[i].type == licenseType then
flag = true
break
end
end
return flag
end
AddEventHandler('esx_license:addLicense', function(target, licenseType, cb)
local xPlayer = ESX.GetPlayerFromId(target)
if xPlayer then
if isValidLicense(licenseType) then
AddLicense(xPlayer.getIdentifier(), licenseType, cb)
else
print('[esx_license] : missing license type in db ' .. licenseType .. ' or someone try to use lua executor id : ' .. target)
end
end
end)
RegisterNetEvent('esx_license:removeLicense')
AddEventHandler('esx_license:removeLicense', function(target, type, cb)
RemoveLicense(target, type, cb)
AddEventHandler('esx_license:removeLicense', function(target, licenseType, cb)
local xPlayer = ESX.GetPlayerFromId(source)
if xPlayer then
if Config.allowedJobs[xPlayer.getJob().name] then
local xTarget = ESX.GetPlayerFromId(target)
if xTarget then
RemoveLicense(xTarget.getIdentifier(), licenseType, cb)
end
else
xPlayer.showNotification('Your job is not allowed to remove the license', 'error', 3000)
end
end
end)
AddEventHandler('esx_license:getLicense', function(type, cb)
GetLicense(type, cb)
AddEventHandler('esx_license:getLicense', function(licenseType, cb)
GetLicense(licenseType, cb)
end)
AddEventHandler('esx_license:getLicenses', function(target, cb)
GetLicenses(target, cb)
local xPlayer = ESX.GetPlayerFromId(target)
if xPlayer then
GetLicenses(xPlayer.getIdentifier(), cb)
end
end)
AddEventHandler('esx_license:checkLicense', function(target, type, cb)
CheckLicense(target, type, cb)
AddEventHandler('esx_license:checkLicense', function(target, licenseType, cb)
local xPlayer = ESX.GetPlayerFromId(target)
if xPlayer then
CheckLicense(xPlayer.getIdentifier(), licenseType, cb)
end
end)
AddEventHandler('esx_license:getLicensesList', function(cb)
GetLicensesList(cb)
end)
ESX.RegisterServerCallback('esx_license:getLicense', function(source, cb, type)
GetLicense(type, cb)
ESX.RegisterServerCallback('esx_license:getLicense', function(source, cb, licenseType)
local xPlayer = ESX.GetPlayerFromId(source)
if xPlayer then
GetLicense(licenseType, cb)
end
end)
ESX.RegisterServerCallback('esx_license:getLicenses', function(source, cb, target)
GetLicenses(target, cb)
local xPlayer = ESX.GetPlayerFromId(target)
if xPlayer then
GetLicenses(xPlayer.getIdentifier(), cb)
end
end)
ESX.RegisterServerCallback('esx_license:checkLicense', function(source, cb, target, type)
CheckLicense(target, type, cb)
ESX.RegisterServerCallback('esx_license:checkLicense', function(source, cb, target, licenseType)
local xPlayer = ESX.GetPlayerFromId(target)
if xPlayer then
CheckLicense(xPlayer.getIdentifier(), licenseType, cb)
end
end)
ESX.RegisterServerCallback('esx_license:getLicensesList', function(source, cb)
+19 -1
View File
@@ -163,6 +163,14 @@ function UpdateMods(data)
props['modSmokeEnabled'] = true
ESX.Game.SetVehicleProperties(vehicle, props)
props = {}
elseif data.modType == 'xenonColor' then
if data.modNum then
props['modXenon'] = true
else
props['modXenon'] = false
end
ESX.Game.SetVehicleProperties(vehicle, props)
props = {}
end
props[data.modType] = data.modNum
@@ -211,7 +219,7 @@ function GetAction(data)
if v.modType then
if v.modType == 22 then
if v.modType == 22 or v.modType == 'xenonColor' then
table.insert(elements, {
label = " " .. TranslateCap('by_default'),
modType = k,
@@ -298,6 +306,16 @@ function GetAction(data)
modType = k,
modNum = true
})
elseif v.modType == 'xenonColor' then -- XENON COLOR
local xenonColors = GetXenonColors()
price = math.floor(vehiclePrice * v.price / 100)
for i = 1, #xenonColors, 1 do
table.insert(elements, {
label = xenonColors[i].label .. ' - <span style="color:green;">$' .. price .. '</span>',
modType = k,
modNum = xenonColors[i].index
})
end
elseif v.modType == 'neonColor' or v.modType == 'tyreSmokeColor' then -- NEON & SMOKE COLOR
local neons = GetNeons()
price = math.floor(vehiclePrice * v.price / 100)
+29 -1
View File
@@ -427,6 +427,27 @@ function GetNeons()
return neons
end
function GetXenonColors()
local xenonColors = {
{label = TranslateCap('neon'), index = -1},
{label = TranslateCap('white'), index = 0},
{label = TranslateCap('blue'), index = 1},
{label = TranslateCap('electric_blue'), index = 2},
{label = TranslateCap('mintgreen'), index = 3},
{label = TranslateCap('lime_green'), index = 4},
{label = TranslateCap('yellow'), index = 5},
{label = TranslateCap('goldenshower'), index = 6},
{label = TranslateCap('orange'), index = 7},
{label = TranslateCap('red'), index = 8},
{label = TranslateCap('ponypink'), index = 9},
{label = TranslateCap('hotpink'), index = 10},
{label = TranslateCap('purple'), index = 11},
{label = TranslateCap('blacklight'), index = 11},
}
return xenonColors
end
function GetPlatesName(index)
if (index == 0) then
return TranslateCap('blue_on_white_1')
@@ -502,7 +523,8 @@ Config.Menus = {
modHorns = TranslateCap('horns'),
neonColor = TranslateCap('neons'),
resprays = TranslateCap('respray'),
modXenon = TranslateCap('headlights'),
-- modXenon = TranslateCap('headlights'),
xenonColor = TranslateCap('headlights'),
plateIndex = TranslateCap('licenseplates'),
wheels = TranslateCap('wheels'),
modPlateHolder = TranslateCap('modplateholder'),
@@ -803,6 +825,12 @@ Config.Menus = {
modType = 22,
price = 3.72
},
xenonColor = {
label = TranslateCap('headlights'),
parent = 'cosmetics',
modType = 'xenonColor',
price = 3.72
},
bodyparts = {
label = TranslateCap('bodyparts'),
parent = 'cosmetics',
+7
View File
@@ -266,4 +266,11 @@ Locales['br'] = {
['fuel_tank'] = 'tanque de combustível',
['windows'] = 'janelas',
['stickers'] = 'autocolantes',
-- Xenon Colors
['mintgreen'] = 'Mint Green',
['goldenshower'] = 'Golden Shower',
['ponypink'] = 'Pony Pink',
['hotpink'] = 'Hot Pink',
['blacklight'] = 'Blacklight',
}
+7
View File
@@ -266,4 +266,11 @@ Locales['de'] = {
['fuel_tank'] = 'Treibstofftank',
['windows'] = 'Fenster',
['stickers'] = 'Designs',
-- Xenon Colors
['mintgreen'] = 'Mint Green',
['goldenshower'] = 'Golden Shower',
['ponypink'] = 'Pony Pink',
['hotpink'] = 'Hot Pink',
['blacklight'] = 'Blacklight',
}
+7
View File
@@ -266,4 +266,11 @@ Locales['en'] = {
['fuel_tank'] = 'fuel tank',
['windows'] = 'windows',
['stickers'] = 'Livery',
-- Xenon Colors
['mintgreen'] = 'Mint Green',
['goldenshower'] = 'Golden Shower',
['ponypink'] = 'Pony Pink',
['hotpink'] = 'Hot Pink',
['blacklight'] = 'Blacklight',
}
+7
View File
@@ -266,4 +266,11 @@ Locales['es'] = {
['fuel_tank'] = 'depósito de combustible',
['windows'] = 'ventanas',
['stickers'] = 'calcomanías',
-- Xenon Colors
['mintgreen'] = 'Mint Green',
['goldenshower'] = 'Golden Shower',
['ponypink'] = 'Pony Pink',
['hotpink'] = 'Hot Pink',
['blacklight'] = 'Blacklight',
}
+7
View File
@@ -266,4 +266,11 @@ Locales['fr'] = {
['fuel_tank'] = 'bouchon du réservoir',
['windows'] = 'fenêtres',
['stickers'] = 'autocollants',
-- Xenon Colors
['mintgreen'] = 'Mint Green',
['goldenshower'] = 'Golden Shower',
['ponypink'] = 'Pony Pink',
['hotpink'] = 'Hot Pink',
['blacklight'] = 'Blacklight',
}
+7
View File
@@ -266,4 +266,11 @@ Locales['hu'] = {
['fuel_tank'] = 'üzemanyag tartály',
['windows'] = 'ablakok',
['stickers'] = 'matricák',
-- Xenon Colors
['mintgreen'] = 'Mint Green',
['goldenshower'] = 'Golden Shower',
['ponypink'] = 'Pony Pink',
['hotpink'] = 'Hot Pink',
['blacklight'] = 'Blacklight',
}
+7
View File
@@ -266,4 +266,11 @@ Locales['it'] = {
['fuel_tank'] = 'serbatoio carburante',
['windows'] = 'finestrini',
['stickers'] = 'Livrea',
-- Xenon Colors
['mintgreen'] = 'Mint Green',
['goldenshower'] = 'Golden Shower',
['ponypink'] = 'Pony Pink',
['hotpink'] = 'Hot Pink',
['blacklight'] = 'Blacklight',
}
+7
View File
@@ -266,4 +266,11 @@ Locales['pl'] = {
['fuel_tank'] = 'zbiornik paliwa',
['windows'] = 'okna',
['stickers'] = 'naklejki',
-- Xenon Colors
['mintgreen'] = 'Mint Green',
['goldenshower'] = 'Golden Shower',
['ponypink'] = 'Pony Pink',
['hotpink'] = 'Hot Pink',
['blacklight'] = 'Blacklight',
}
+7
View File
@@ -266,4 +266,11 @@ Locales['si'] = {
['fuel_tank'] = 'rezervoar za gorivo',
['windows'] = 'okna',
['stickers'] = 'nalepke',
-- Xenon Colors
['mintgreen'] = 'Mint Green',
['goldenshower'] = 'Golden Shower',
['ponypink'] = 'Pony Pink',
['hotpink'] = 'Hot Pink',
['blacklight'] = 'Blacklight',
}
+53 -28
View File
@@ -115,7 +115,8 @@ function OpenBossMenu(society, close, options)
local elements = {
{unselectable = true, icon = "fas fa-wallet", title = TranslateCap('withdraw_amount'), description = "Withdraw money from the society account"},
{icon = "fas fa-wallet", title = "Amount", input = true, inputType = "number", inputPlaceholder = "Amount to withdraw..", inputMin = 1, inputMax = 250000, name = "withdraw"},
{icon = "fas fa-check", title = "Confirm", value = "confirm"}
{icon = "fas fa-check", title = "Confirm", value = "confirm"},
{icon = "fas fa-arrow-left", title = "Return", value = "return"}
}
ESX.RefreshContext(elements)
elseif element.value == "confirm" then
@@ -130,7 +131,8 @@ function OpenBossMenu(society, close, options)
local elements = {
{unselectable = true, icon = "fas fa-wallet", title = TranslateCap('deposit_amount'), description = "Deposit some money into the society account"},
{icon = "fas fa-wallet", title = "Amount", input = true, inputType = "number", inputPlaceholder = "Amount to deposit..", inputMin = 1, inputMax = 250000, name = "deposit"},
{icon = "fas fa-check", title = "Confirm", value = "confirm2"}
{icon = "fas fa-check", title = "Confirm", value = "confirm2"},
{icon = "fas fa-arrow-left", title = "Return", value = "return"}
}
ESX.RefreshContext(elements)
elseif element.value == "confirm2" then
@@ -145,7 +147,8 @@ function OpenBossMenu(society, close, options)
local elements = {
{unselectable = true, icon = "fas fa-wallet", title = TranslateCap('wash_money_amount'), description = "Deposit some money into the money wash"},
{icon = "fas fa-wallet", title = "Amount", input = true, inputType = "number", inputPlaceholder = "Amount to wash..", inputMin = 1, inputMax = 250000, name = "wash"},
{icon = "fas fa-check", title = "Confirm", value = "confirm3"}
{icon = "fas fa-check", title = "Confirm", value = "confirm3"},
{icon = "fas fa-arrow-left", title = "Return", value = "return"}
}
ESX.RefreshContext(elements)
elseif element.value == "confirm3" then
@@ -157,33 +160,40 @@ function OpenBossMenu(society, close, options)
ESX.CloseContext()
end
elseif element.value == "manage_employees" then
OpenManageEmployeesMenu(society)
OpenManageEmployeesMenu(society, options)
elseif element.value == "manage_salary" then
OpenManageSalaryMenu(society)
OpenManageSalaryMenu(society, options)
elseif element.value == "manage_grades" then
OpenManageGradesMenu(society)
OpenManageGradesMenu(society, options)
elseif element.value == "return" then
OpenBossMenu(society, nil, options)
end
end)
end
end, society)
end
function OpenManageEmployeesMenu(society)
function OpenManageEmployeesMenu(society, options)
local elements = {
{unselectable = true, icon = "fas fa-users", title = TranslateCap('employee_management')},
{icon = "fas fa-users", title = TranslateCap('employee_list'), value = "employee_list"},
{icon = "fas fa-users", title = TranslateCap('recruit'), value = "recruit"}
}
elements[#elements+1] = {icon = "fas fa-arrow-left", title = "Return", value = "return"}
ESX.OpenContext("right", elements, function(menu,element)
if element.value == "employee_list" then
OpenEmployeeList(society)
OpenEmployeeList(society, options)
elseif element.value == "recruit" then
OpenRecruitMenu(society)
OpenRecruitMenu(society, options)
elseif element.value == "return" then
OpenBossMenu(society, nil, options)
end
end)
end
function OpenEmployeeList(society)
function OpenEmployeeList(society, options)
ESX.TriggerServerCallback('esx_society:getEmployees', function(employees)
local elements = {
{unselectable = true, icon = "fas fa-user", title = "Employees"}
@@ -199,7 +209,7 @@ function OpenEmployeeList(society)
ESX.OpenContext("right", elements, function(menu,element)
if element.value == "return" then
OpenManageEmployeesMenu(society)
OpenManageEmployeesMenu(society, options)
else
local elements2 = {
{unselectable = true, icon = "fas fa-user", title = element.title},
@@ -211,15 +221,15 @@ function OpenEmployeeList(society)
local employee = element.data
if element2.value == "promote" then
ESX.CloseContext()
OpenPromoteMenu(society, employee)
OpenPromoteMenu(society, employee, options)
elseif element2.value == "fire" then
ESX.ShowNotification(TranslateCap('you_have_fired', employee.name))
ESX.TriggerServerCallback('esx_society:setJob', function()
OpenEmployeeList(society)
OpenEmployeeList(society, options)
end, employee.identifier, 'unemployed', 0, 'fire')
elseif element2.value == "return" then
OpenEmployeeList(society)
OpenEmployeeList(society, options)
end
end)
end
@@ -227,7 +237,7 @@ function OpenEmployeeList(society)
end, society)
end
function OpenRecruitMenu(society)
function OpenRecruitMenu(society, options)
ESX.TriggerServerCallback('esx_society:getOnlinePlayers', function(players)
local elements = {
{unselectable = true, icon = "fas fa-user", title = TranslateCap('recruiting')}
@@ -243,7 +253,7 @@ function OpenRecruitMenu(society)
ESX.OpenContext("right", elements, function(menu,element)
if element.value == "return" then
OpenManageEmployeesMenu(society)
OpenManageEmployeesMenu(society, options)
else
local elements2 = {
{unselectable = true, icon = "fas fa-user", title = "Confirm"},
@@ -255,7 +265,7 @@ function OpenRecruitMenu(society)
ESX.ShowNotification(TranslateCap('you_have_hired', element.name))
ESX.TriggerServerCallback('esx_society:setJob', function()
OpenRecruitMenu(society)
OpenRecruitMenu(society, options)
end, element.identifier, society, 0, 'hire')
end
end)
@@ -264,7 +274,7 @@ function OpenRecruitMenu(society)
end)
end
function OpenPromoteMenu(society, employee)
function OpenPromoteMenu(society, employee, options)
ESX.TriggerServerCallback('esx_society:getJob', function(job)
local elements = {
{unselectable = true, icon = "fas fa-user", title = TranslateCap('promote_employee', employee.name)}
@@ -280,21 +290,21 @@ function OpenPromoteMenu(society, employee)
ESX.OpenContext("right", elements, function(menu,element)
if element.value == "return" then
OpenEmployeeList(society)
OpenEmployeeList(society, options)
else
ESX.ShowNotification(TranslateCap('you_have_promoted', employee.name, element.title))
ESX.TriggerServerCallback('esx_society:setJob', function()
OpenEmployeeList(society)
OpenEmployeeList(society, options)
end, employee.identifier, society, element.value, 'promote')
end
end, function(menu)
OpenEmployeeList(society)
OpenEmployeeList(society, options)
end)
end, society)
end
function OpenManageSalaryMenu(society)
function OpenManageSalaryMenu(society, options)
ESX.TriggerServerCallback('esx_society:getJob', function(job)
local elements = {
{unselectable = true, icon = "fas fa-wallet", title = TranslateCap('salary_management')}
@@ -309,6 +319,8 @@ function OpenManageSalaryMenu(society)
value = job.grades[i].grade
}
end
elements[#elements+1] = {icon = "fas fa-arrow-left", title = "Return", value = "return"}
ESX.OpenContext("right", elements, function(menu,element)
local elements = {
@@ -322,21 +334,25 @@ function OpenManageSalaryMenu(society)
local amount = tonumber(menu.eles[2].inputValue)
if amount == nil then
ESX.ShowNotification(TranslateCap('invalid_amount'))
ESX.ShowNotification(TranslateCap('invalid_value_nochanges'))
OpenManageSalaryMenu(society, options)
elseif amount > Config.MaxSalary then
ESX.ShowNotification(TranslateCap('invalid_amount_max'))
OpenManageSalaryMenu(society, options)
else
ESX.CloseContext()
ESX.TriggerServerCallback('esx_society:setJobSalary', function()
OpenManageSalaryMenu(society)
OpenManageSalaryMenu(society, options)
end, society, menu.eles[1].value, amount)
end
elseif element.value == "return" then
OpenBossMenu(society, nil, options)
end
end)
end, society)
end
function OpenManageGradesMenu(society)
function OpenManageGradesMenu(society, options)
ESX.TriggerServerCallback('esx_society:getJob', function(job)
local elements = {
{unselectable = true, icon = "fas fa-wallet", title = TranslateCap('grade_management')}
@@ -347,6 +363,8 @@ function OpenManageGradesMenu(society)
elements[#elements+1] = {icon = "fas fa-wallet", title = ('%s'):format(gradeLabel), value = job.grades[i].grade}
end
elements[#elements+1] = {icon = "fas fa-arrow-left", title = "Return", value = "return"}
ESX.OpenContext("right", elements, function(menu,element)
local elements = {
@@ -357,11 +375,18 @@ function OpenManageGradesMenu(society)
ESX.RefreshContext(elements)
if element.value == "confirm" then
local label = tostring(menu.eles[2].inputValue)
if menu.eles[2].inputValue then
local label = tostring(menu.eles[2].inputValue)
ESX.TriggerServerCallback('esx_society:setJobLabel', function()
OpenManageGradesMenu(society)
ESX.TriggerServerCallback('esx_society:setJobLabel', function()
OpenManageGradesMenu(society, options)
end, society, menu.eles[1].value, label)
else
ESX.ShowNotification(TranslateCap('invalid_value_nochanges'))
OpenManageGradesMenu(society, options)
end
elseif element.value == "return" then
OpenBossMenu(society, nil, options)
end
end)
end, society)
+3 -1
View File
@@ -13,7 +13,9 @@ Locales['br'] = {
['have_deposited'] = 'você depositou ~r~$%s',
['have_withdrawn'] = 'você retirou $%s',
['invalid_amount'] = 'montante inválido',
['invalid_amount_max'] = 'esse salário não é permitido',
['invalid_amount_max'] = 'esse salário não é permitido',
['invalid_value'] = 'invalid value',
['invalid_value_nochanges']= 'invalid value, no changes applied',
['no'] = 'não',
['promote'] = 'promover',
['promote_employee'] = 'promover %s',
+2
View File
@@ -14,6 +14,8 @@ Locales['cs'] = {
['have_withdrawn'] = 'vybral jsi $%s',
['invalid_amount'] = 'neplatná částka',
['invalid_amount_max'] = 'tento plat není povolen',
['invalid_value'] = 'invalid value',
['invalid_value_nochanges']= 'invalid value, no changes applied',
['no'] = 'ne',
['promote'] = 'povýšit',
['promote_employee'] = 'povýšit %s',
+2
View File
@@ -15,6 +15,8 @@ Locales['en'] = {
['check_balance'] = 'balance is ~g~$%s',
['invalid_amount'] = 'invalid amount',
['invalid_amount_max'] = 'that salary is not allowed',
['invalid_value'] = 'invalid value',
['invalid_value_nochanges']= 'invalid value, no changes applied',
['no'] = 'no',
['promote'] = 'promote',
['promote_employee'] = 'promote %s',
+3 -5
View File
@@ -11,10 +11,11 @@ Locales['es'] = {
['fire'] = 'Despedir',
['grade'] = 'Cargo',
['have_deposited'] = 'Has depositado ~r~%s$',
['check_balance'] = 'el balance es ~g~$%s',
['have_withdrawn'] = 'Has retirado %s$',
['invalid_amount'] = 'Cantidad inválida',
['invalid_amount_max'] = 'Ese salario no está permitido',
['invalid_amount_max'] = 'Ese salario no está permitido',
['invalid_value'] = 'invalid value',
['invalid_value_nochanges']= 'invalid value, no changes applied',
['no'] = 'No',
['promote'] = 'Ascender',
['promote_employee'] = 'Ascender %s',
@@ -22,9 +23,6 @@ Locales['es'] = {
['recruiting'] = 'Contratando',
['salary_amount'] = 'Cantidad de salario',
['salary_management'] = 'Gestión de salario',
['grade_management'] = 'gestión de etiquetas de grado',
['grade_label'] = 'etiqueta de grado',
['check_society_balance'] = 'comprobar el balance de la sociedad',
['wash_money'] = 'Limpiar dinero',
['wash_money_amount'] = 'Cantidad para limpiar',
['withdraw_amount'] = 'Retirar cantidad',
+3 -1
View File
@@ -13,7 +13,9 @@ Locales['fi'] = {
['have_deposited'] = 'sinä talletit ~r~€%s',
['have_withdrawn'] = 'sinä nostit €%s',
['invalid_amount'] = 'virheellinen summa',
['invalid_amount_max'] = 'that salary is not allowed',
['invalid_amount_max'] = 'that salary is not allowed',
['invalid_value'] = 'invalid value',
['invalid_value_nochanges']= 'invalid value, no changes applied',
['no'] = 'ei',
['promote'] = 'ylennä',
['promote_employee'] = 'ylennä henkilö %s',
+2
View File
@@ -13,6 +13,8 @@ Locales['fr'] = {
['have_deposited'] = 'vous avez déposé ~r~$%s',
['have_withdrawn'] = 'vous avez retiré $%s',
['invalid_amount'] = 'montant invalide',
['invalid_value'] = 'valeur invalide',
['invalid_value_nochanges']= 'valeur invalide, aucun changements appliqués',
['invalid_amount_max'] = 'ce salaire est non réglementaire',
['no'] = 'non',
['promote'] = 'promouvoir',
+3 -1
View File
@@ -13,7 +13,9 @@ Locales['hu'] = {
['have_deposited'] = 'Sikeresen beraktál ~r~%s $',
['have_withdrawn'] = 'Sikeresen kivettél %s $',
['invalid_amount'] = 'Érvénytelen mennyiség',
['invalid_amount_max'] = 'Ez az összeg több mint a megengedett',
['invalid_amount_max'] = 'Ez az összeg több mint a megengedett',
['invalid_value'] = 'invalid value',
['invalid_value_nochanges']= 'invalid value, no changes applied',
['no'] = 'Nem',
['promote'] = 'Elöléptetés',
['promote_employee'] = 'Elöléptetés %s',
+3 -5
View File
@@ -12,9 +12,10 @@ Locales['it'] = {
['grade'] = 'grado',
['have_deposited'] = 'hai depositato ~r~$%s',
['have_withdrawn'] = 'hai prelevato $%s',
['check_balance'] = 'il bilancio è ~g~$%s',
['invalid_amount'] = 'importo non valido',
['invalid_amount_max'] = 'quel salario non è consentito',
['invalid_amount_max'] = 'quel salario non è consentito',
['invalid_value'] = 'valore non valido',
['invalid_value_nochanges']= 'valore non valido, nessuna modifica applicata',
['no'] = 'no',
['promote'] = 'promuovi',
['promote_employee'] = 'promuovere il dipendente %s',
@@ -22,9 +23,6 @@ Locales['it'] = {
['recruiting'] = 'reclutamento',
['salary_amount'] = 'importo dello stipendio',
['salary_management'] = 'gestione stipendi',
['grade_management'] = 'gestione dei gradi',
['grade_label'] = 'grado',
['check_society_balance'] = 'controlla bilancio società',
['wash_money'] = 'ricicla denaro',
['wash_money_amount'] = 'importo da riciclare',
['withdraw_amount'] = 'ritira importo',
+3 -1
View File
@@ -13,7 +13,9 @@ Locales['nl'] = {
['have_deposited'] = 'je hebt gestort ~r~$%s',
['have_withdrawn'] = 'je hebt opgenomen $%s',
['invalid_amount'] = 'ongeldige hoeveelheid',
['invalid_amount_max'] = 'dit salaris is niet toegestaan',
['invalid_amount_max'] = 'dit salaris is niet toegestaan',
['invalid_value'] = 'invalid value',
['invalid_value_nochanges']= 'invalid value, no changes applied',
['no'] = 'nee',
['promote'] = 'promoveer',
['promote_employee'] = 'promoveer %s',
+3 -1
View File
@@ -13,7 +13,9 @@ Locales['pl'] = {
['have_deposited'] = 'zdeponowałeś ~r~$%s',
['have_withdrawn'] = 'wypłaciłeś $%s',
['invalid_amount'] = 'nieprawidłowa wartość',
['invalid_amount_max'] = 'that salary is not allowed',
['invalid_amount_max'] = 'that salary is not allowed',
['invalid_value'] = 'invalid value',
['invalid_value_nochanges']= 'invalid value, no changes applied',
['no'] = 'nie',
['promote'] = 'awansuj',
['promote_employee'] = 'awansuj %s',
+3 -1
View File
@@ -13,7 +13,9 @@ Locales['si'] = {
['have_deposited'] = 'deponirali ste ~r~$%s',
['have_withdrawn'] = 'umaknili ste $%s',
['invalid_amount'] = 'neveljaven znesek',
['invalid_amount_max'] = 'ta plača ni dovoljena',
['invalid_amount_max'] = 'ta plača ni dovoljena',
['invalid_value'] = 'invalid value',
['invalid_value_nochanges']= 'invalid value, no changes applied',
['no'] = 'ne',
['promote'] = 'spodbujam',
['promote_employee'] = 'promoviraj %s',
+3 -1
View File
@@ -13,7 +13,9 @@ Locales['sv'] = {
['have_deposited'] = 'du har satt in ~r~%s SEK',
['have_withdrawn'] = 'du har tagit ut %s SEK',
['invalid_amount'] = 'ogiltigt belopp',
['invalid_amount_max'] = 'den lönen är inte tillåten',
['invalid_amount_max'] = 'den lönen är inte tillåten',
['invalid_value'] = 'invalid value',
['invalid_value_nochanges']= 'invalid value, no changes applied',
['no'] = 'nej',
['promote'] = 'befodra',
['promote_employee'] = 'befodra %s',
+3 -1
View File
@@ -13,7 +13,9 @@ Locales['tr'] = {
['have_deposited'] = '~r~%s lira yatırdın',
['have_withdrawn'] = '$%s lira çektin',
['invalid_amount'] = 'miktar hatalı',
['invalid_amount_max'] = 'bu maaşa izin verilmiyor',
['invalid_amount_max'] = 'bu maaşa izin verilmiyor',
['invalid_value'] = 'invalid value',
['invalid_value_nochanges']= 'invalid value, no changes applied',
['no'] = 'hayır',
['promote'] = 'yükseltme',
['promote_employee'] = 'yükselt %s',
+5 -5
View File
@@ -287,7 +287,7 @@ ESX.RegisterServerCallback('esx_society:getJob', function(source, cb, society)
cb(job)
end)
ESX.RegisterServerCallback('esx_society:setJob', function(source, cb, identifier, job, grade, type)
ESX.RegisterServerCallback('esx_society:setJob', function(source, cb, identifier, job, grade, actionType)
local xPlayer = ESX.GetPlayerFromId(source)
local isBoss = xPlayer.job.grade_name == 'boss'
local xTarget = ESX.GetPlayerFromIdentifier(identifier)
@@ -297,13 +297,13 @@ ESX.RegisterServerCallback('esx_society:setJob', function(source, cb, identifier
if xTarget then
xTarget.setJob(job, grade)
if type == 'hire' then
if actionType == 'hire' then
xTarget.showNotification(TranslateCap('you_have_been_hired', job))
xPlayer.showNotification(TranslateCap("you_have_hired", xTarget.getName()))
elseif type == 'promote' then
elseif actionType == 'promote' then
xTarget.showNotification(TranslateCap('you_have_been_promoted'))
xPlayer.showNotification(TranslateCap("you_have_promoted", xTarget.getName()))
elseif type == 'fire' then
xPlayer.showNotification(TranslateCap("you_have_promoted", xTarget.getName(), xTarget.getJob().label))
elseif actionType == 'fire' then
xTarget.showNotification(TranslateCap('you_have_been_fired', xTarget.getJob().label))
xPlayer.showNotification(TranslateCap("you_have_fired", xTarget.getName()))
end