diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..41c2aaf2 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +indent_size = 2 +indent_style = space +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true \ No newline at end of file diff --git a/es_extended.sql b/es_extended.sql index 15ce8398..4c60754b 100644 --- a/es_extended.sql +++ b/es_extended.sql @@ -1,16 +1,16 @@ USE `essentialmode`; -ALTER TABLE `users` - ADD COLUMN `name` VARCHAR(255) NULL DEFAULT '' AFTER `money`, - ADD COLUMN `skin` LONGTEXT NULL AFTER `name`, - ADD COLUMN `job` varchar(255) NULL DEFAULT 'unemployed' AFTER `skin`, - ADD COLUMN `job_grade` INT NULL DEFAULT 0 AFTER `job`, - ADD COLUMN `loadout` LONGTEXT NULL AFTER `job_grade`, - ADD COLUMN `position` VARCHAR(255) NULL AFTER `loadout` +ALTER TABLE `users` + ADD COLUMN `name` VARCHAR(255) NULL DEFAULT '' AFTER `money`, + ADD COLUMN `skin` LONGTEXT NULL AFTER `name`, + ADD COLUMN `job` varchar(255) NULL DEFAULT 'unemployed' AFTER `skin`, + ADD COLUMN `job_grade` INT NULL DEFAULT 0 AFTER `job`, + ADD COLUMN `loadout` LONGTEXT NULL AFTER `job_grade`, + ADD COLUMN `position` VARCHAR(255) NULL AFTER `loadout` ; CREATE TABLE `items` ( - + `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `label` varchar(255) NOT NULL, @@ -22,7 +22,7 @@ CREATE TABLE `items` ( ); CREATE TABLE `job_grades` ( - + `id` int(11) NOT NULL AUTO_INCREMENT, `job_name` varchar(255) DEFAULT NULL, `grade` int(11) NOT NULL, @@ -31,39 +31,39 @@ CREATE TABLE `job_grades` ( `salary` int(11) NOT NULL, `skin_male` longtext NOT NULL, `skin_female` longtext NOT NULL, - + PRIMARY KEY (`id`) ); INSERT INTO `job_grades` VALUES (1,'unemployed',0,'rsa','RSA',200,'{}','{}'); CREATE TABLE `jobs` ( - + `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `label` varchar(255) DEFAULT NULL, - + PRIMARY KEY (`id`) ); INSERT INTO `jobs` VALUES (1,'unemployed','Chômeur'); CREATE TABLE `user_accounts` ( - + `id` int(11) NOT NULL AUTO_INCREMENT, `identifier` varchar(255) NOT NULL, `name` varchar(255) NOT NULL, `money` double NOT NULL DEFAULT '0', - + PRIMARY KEY (`id`) ); CREATE TABLE `user_inventory` ( - + `id` int(11) NOT NULL AUTO_INCREMENT, `identifier` varchar(255) NOT NULL, `item` varchar(255) NOT NULL, `count` int(11) NOT NULL, - + PRIMARY KEY (`id`) ); diff --git a/localization/de_es_extended.sql b/localization/de_es_extended.sql index 9e4add3a..2350a6cd 100644 --- a/localization/de_es_extended.sql +++ b/localization/de_es_extended.sql @@ -1,16 +1,16 @@ USE `essentialmode`; -ALTER TABLE `users` - ADD COLUMN `name` VARCHAR(255) NULL DEFAULT '' AFTER `money`, - ADD COLUMN `skin` LONGTEXT NULL AFTER `name`, - ADD COLUMN `job` varchar(255) NULL DEFAULT 'unemployed' AFTER `skin`, - ADD COLUMN `job_grade` INT NULL DEFAULT 0 AFTER `job`, - ADD COLUMN `loadout` LONGTEXT NULL AFTER `job_grade`, - ADD COLUMN `position` VARCHAR(255) NULL AFTER `loadout` +ALTER TABLE `users` + ADD COLUMN `name` VARCHAR(255) NULL DEFAULT '' AFTER `money`, + ADD COLUMN `skin` LONGTEXT NULL AFTER `name`, + ADD COLUMN `job` varchar(255) NULL DEFAULT 'unemployed' AFTER `skin`, + ADD COLUMN `job_grade` INT NULL DEFAULT 0 AFTER `job`, + ADD COLUMN `loadout` LONGTEXT NULL AFTER `job_grade`, + ADD COLUMN `position` VARCHAR(255) NULL AFTER `loadout` ; CREATE TABLE `items` ( - + `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `label` varchar(255) NOT NULL, @@ -22,7 +22,7 @@ CREATE TABLE `items` ( ); CREATE TABLE `job_grades` ( - + `id` int(11) NOT NULL AUTO_INCREMENT, `job_name` varchar(255) DEFAULT NULL, `grade` int(11) NOT NULL, @@ -31,39 +31,39 @@ CREATE TABLE `job_grades` ( `salary` int(11) NOT NULL, `skin_male` longtext NOT NULL, `skin_female` longtext NOT NULL, - + PRIMARY KEY (`id`) ); INSERT INTO `job_grades` VALUES (1,'unemployed',0,'rsa','Arbeitslos',200,'{}','{}'); CREATE TABLE `jobs` ( - + `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `label` varchar(255) DEFAULT NULL, - + PRIMARY KEY (`id`) ); INSERT INTO `jobs` VALUES (1,'unemployed','Suchend'); CREATE TABLE `user_accounts` ( - + `id` int(11) NOT NULL AUTO_INCREMENT, `identifier` varchar(255) NOT NULL, `name` varchar(255) NOT NULL, `money` double NOT NULL DEFAULT '0', - + PRIMARY KEY (`id`) ); CREATE TABLE `user_inventory` ( - + `id` int(11) NOT NULL AUTO_INCREMENT, `identifier` varchar(255) NOT NULL, `item` varchar(255) NOT NULL, `count` int(11) NOT NULL, - + PRIMARY KEY (`id`) ); diff --git a/localization/en_es_extended.sql b/localization/en_es_extended.sql index f2584874..dcef2c84 100644 --- a/localization/en_es_extended.sql +++ b/localization/en_es_extended.sql @@ -1,16 +1,16 @@ USE `essentialmode`; -ALTER TABLE `users` - ADD COLUMN `name` VARCHAR(255) NULL DEFAULT '' AFTER `money`, - ADD COLUMN `skin` LONGTEXT NULL AFTER `name`, - ADD COLUMN `job` varchar(255) NULL DEFAULT 'unemployed' AFTER `skin`, - ADD COLUMN `job_grade` INT NULL DEFAULT 0 AFTER `job`, - ADD COLUMN `loadout` LONGTEXT NULL AFTER `job_grade`, - ADD COLUMN `position` VARCHAR(255) NULL AFTER `loadout` +ALTER TABLE `users` + ADD COLUMN `name` VARCHAR(255) NULL DEFAULT '' AFTER `money`, + ADD COLUMN `skin` LONGTEXT NULL AFTER `name`, + ADD COLUMN `job` varchar(255) NULL DEFAULT 'unemployed' AFTER `skin`, + ADD COLUMN `job_grade` INT NULL DEFAULT 0 AFTER `job`, + ADD COLUMN `loadout` LONGTEXT NULL AFTER `job_grade`, + ADD COLUMN `position` VARCHAR(255) NULL AFTER `loadout` ; CREATE TABLE `items` ( - + `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `label` varchar(255) NOT NULL, @@ -22,7 +22,7 @@ CREATE TABLE `items` ( ); CREATE TABLE `job_grades` ( - + `id` int(11) NOT NULL AUTO_INCREMENT, `job_name` varchar(255) DEFAULT NULL, `grade` int(11) NOT NULL, @@ -31,39 +31,39 @@ CREATE TABLE `job_grades` ( `salary` int(11) NOT NULL, `skin_male` longtext NOT NULL, `skin_female` longtext NOT NULL, - + PRIMARY KEY (`id`) ); INSERT INTO `job_grades` VALUES (1,'unemployed',0,'rsa','Welfare',200,'{}','{}'); CREATE TABLE `jobs` ( - + `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `label` varchar(255) DEFAULT NULL, - + PRIMARY KEY (`id`) ); INSERT INTO `jobs` VALUES (1,'unemployed','Unemployed'); CREATE TABLE `user_accounts` ( - + `id` int(11) NOT NULL AUTO_INCREMENT, `identifier` varchar(255) NOT NULL, `name` varchar(255) NOT NULL, `money` double NOT NULL DEFAULT '0', - + PRIMARY KEY (`id`) ); CREATE TABLE `user_inventory` ( - + `id` int(11) NOT NULL AUTO_INCREMENT, `identifier` varchar(255) NOT NULL, `item` varchar(255) NOT NULL, `count` int(11) NOT NULL, - + PRIMARY KEY (`id`) ); diff --git a/resources/[essential]/es_extended/__resource.lua b/resources/[essential]/es_extended/__resource.lua index 9557254a..26694ac3 100644 --- a/resources/[essential]/es_extended/__resource.lua +++ b/resources/[essential]/es_extended/__resource.lua @@ -3,69 +3,68 @@ resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937' description 'ES Extended' server_scripts { - '@async/async.lua', - '@mysql-async/lib/MySQL.lua', - 'config.lua', - 'locale.lua', - 'locales/de.lua', - 'locales/br.lua', - 'locales/fr.lua', - 'locales/en.lua', - 'config.weapons.lua', - 'server/common.lua', - 'server/classes/player.lua', - 'server/functions.lua', - 'server/paycheck.lua', - 'server/main.lua', - 'server/commands.lua' + '@async/async.lua', + '@mysql-async/lib/MySQL.lua', + 'config.lua', + 'locale.lua', + 'locales/de.lua', + 'locales/br.lua', + 'locales/fr.lua', + 'locales/en.lua', + 'config.weapons.lua', + 'server/common.lua', + 'server/classes/player.lua', + 'server/functions.lua', + 'server/paycheck.lua', + 'server/main.lua', + 'server/commands.lua' } client_scripts { - 'config.lua', - 'locale.lua', - 'locales/de.lua', - 'locales/br.lua', - 'locales/fr.lua', - 'locales/en.lua', - 'config.weapons.lua', - 'client/common.lua', - 'client/entityiter.lua', - 'client/functions.lua', - 'client/main.lua' + 'config.lua', + 'locale.lua', + 'locales/de.lua', + 'locales/br.lua', + 'locales/fr.lua', + 'locales/en.lua', + 'config.weapons.lua', + 'client/common.lua', + 'client/entityiter.lua', + 'client/functions.lua', + 'client/main.lua' } ui_page { - 'html/ui.html' + 'html/ui.html' } files { + 'html/ui.html', - 'html/ui.html', - - 'html/css/app.css', + 'html/css/app.css', - 'html/js/mustache.min.js', - 'html/js/app.js', - - 'html/fonts/pdown.ttf', - 'html/fonts/bankgothic.ttf', + 'html/js/mustache.min.js', + 'html/js/app.js', - 'html/img/cursor.png', - 'html/img/keys/enter.png', - 'html/img/keys/return.png', + 'html/fonts/pdown.ttf', + 'html/fonts/bankgothic.ttf', - 'html/img/accounts/bank.png', - 'html/img/accounts/black_money.png' + 'html/img/cursor.png', + 'html/img/keys/enter.png', + 'html/img/keys/return.png', + + 'html/img/accounts/bank.png', + 'html/img/accounts/black_money.png' } exports { - 'getSharedObject' + 'getSharedObject' } server_exports { - 'getSharedObject' + 'getSharedObject' } dependencies { - 'essentialmode' -} \ No newline at end of file + 'essentialmode' +} diff --git a/resources/[essential]/es_extended/client/common.lua b/resources/[essential]/es_extended/client/common.lua index 26c0ed40..14b6a4e6 100644 --- a/resources/[essential]/es_extended/client/common.lua +++ b/resources/[essential]/es_extended/client/common.lua @@ -1,7 +1,7 @@ AddEventHandler('esx:getSharedObject', function(cb) - cb(ESX) + cb(ESX) end) function getSharedObject() - return ESX + return ESX end diff --git a/resources/[essential]/es_extended/client/entityiter.lua b/resources/[essential]/es_extended/client/entityiter.lua index 71e9ee23..7c7ec4d5 100644 --- a/resources/[essential]/es_extended/client/entityiter.lua +++ b/resources/[essential]/es_extended/client/entityiter.lua @@ -41,16 +41,16 @@ local function EnumerateEntities(initFunc, moveFunc, disposeFunc) disposeFunc(iter) return end - + local enum = {handle = iter, destructor = disposeFunc} setmetatable(enum, entityEnumerator) - + local next = true repeat coroutine.yield(id) next, id = moveFunc(iter) until not next - + enum.destructor, enum.handle = nil, nil disposeFunc(iter) end) @@ -76,4 +76,4 @@ end for ped in EnumeratePeds() do end -]] \ No newline at end of file +]] diff --git a/resources/[essential]/es_extended/client/functions.lua b/resources/[essential]/es_extended/client/functions.lua index 7c6eb4b8..6729f0da 100644 --- a/resources/[essential]/es_extended/client/functions.lua +++ b/resources/[essential]/es_extended/client/functions.lua @@ -20,7 +20,7 @@ ESX.Game = {} ESX.Game.Utils = {} ESX.GetConfig = function() - return Config + return Config end ESX.GetRandomString = function(length) @@ -32,368 +32,368 @@ ESX.GetRandomString = function(length) else return '' end - + end ESX.SetTimeout = function(msec, cb) - table.insert(ESX.TimeoutCallbacks, { - time = GetGameTimer() + msec, - cb = cb - }) - return #ESX.TimeoutCallbacks + table.insert(ESX.TimeoutCallbacks, { + time = GetGameTimer() + msec, + cb = cb + }) + return #ESX.TimeoutCallbacks end ESX.ClearTimeout = function(i) - ESX.TimeoutCallbacks[i] = nil + ESX.TimeoutCallbacks[i] = nil end ESX.IsPlayerLoaded = function() - return ESX.PlayerLoaded + return ESX.PlayerLoaded end ESX.GetPlayerData = function() - return ESX.PlayerData + return ESX.PlayerData end ESX.SetPlayerData = function(key, val) - ESX.PlayerData[key] = val + ESX.PlayerData[key] = val end ESX.ShowNotification = function(msg) - SetNotificationTextEntry('STRING') - AddTextComponentString(msg) - DrawNotification(0,1) + SetNotificationTextEntry('STRING') + AddTextComponentString(msg) + DrawNotification(0,1) end ESX.TriggerServerCallback = function(name, cb, ...) - - ESX.ServerCallbacks[ESX.CurrentRequestId] = cb - - TriggerServerEvent('esx:triggerServerCallback', name, ESX.CurrentRequestId, ...) - - if ESX.CurrentRequestId < 65535 then - ESX.CurrentRequestId = ESX.CurrentRequestId + 1 - else - ESX.CurrentRequestId = 0 - end + + ESX.ServerCallbacks[ESX.CurrentRequestId] = cb + + TriggerServerEvent('esx:triggerServerCallback', name, ESX.CurrentRequestId, ...) + + if ESX.CurrentRequestId < 65535 then + ESX.CurrentRequestId = ESX.CurrentRequestId + 1 + else + ESX.CurrentRequestId = 0 + end end ESX.UI.HUD.SetDisplay = function(opacity) - SendNUIMessage({ - action = 'setHUDDisplay', - opacity = opacity - }) + SendNUIMessage({ + action = 'setHUDDisplay', + opacity = opacity + }) end ESX.UI.HUD.RegisterElement = function(name, index, priority, html, data) - local found = false + local found = false - for i=1, #ESX.UI.HUD.RegisteredElements, 1 do - if ESX.UI.HUD.RegisteredElements[i] == name then - found = true - break - end - end + for i=1, #ESX.UI.HUD.RegisteredElements, 1 do + if ESX.UI.HUD.RegisteredElements[i] == name then + found = true + break + end + end - if found then - return - end + if found then + return + end - table.insert(ESX.UI.HUD.RegisteredElements, name) + table.insert(ESX.UI.HUD.RegisteredElements, name) - SendNUIMessage({ - action = 'insertHUDElement', - name = name, - index = index, - priority = priority, - html = html, - data = data, - }) + SendNUIMessage({ + action = 'insertHUDElement', + name = name, + index = index, + priority = priority, + html = html, + data = data, + }) - ESX.UI.HUD.UpdateElement(name, data) + ESX.UI.HUD.UpdateElement(name, data) end ESX.UI.HUD.RemoveElement = function(name) - for i=1, #ESX.UI.HUD.RegisteredElements, 1 do - if ESX.UI.HUD.RegisteredElements[i] == name then - table.remove(ESX.UI.HUD.RegisteredElements, i) - break - end - end + for i=1, #ESX.UI.HUD.RegisteredElements, 1 do + if ESX.UI.HUD.RegisteredElements[i] == name then + table.remove(ESX.UI.HUD.RegisteredElements, i) + break + end + end - SendNUIMessage({ - action = 'deleteHUDElement', - name = name - }) + SendNUIMessage({ + action = 'deleteHUDElement', + name = name + }) end ESX.UI.HUD.UpdateElement = function(name, data) - SendNUIMessage({ - action = 'updateHUDElement', - name = name, - data = data, - }) + SendNUIMessage({ + action = 'updateHUDElement', + name = name, + data = data, + }) end ESX.UI.Menu.RegisterType = function(type, open, close) - ESX.UI.Menu.RegisteredTypes[type] = { - open = open, - close = close, - } + ESX.UI.Menu.RegisteredTypes[type] = { + open = open, + close = close, + } end local _type = type ESX.UI.Menu.Open = function(type, namespace, name, data, submit, cancel, change, close) - - local menu = {} - menu.type = type - menu.namespace = namespace - menu.name = name - menu.data = data - menu.submit = submit - menu.cancel = cancel - menu.change = change - - menu.close = function() - - ESX.UI.Menu.RegisteredTypes[type].close(namespace, name) - - for i=1, #ESX.UI.Menu.Opened, 1 do + local menu = {} - if ESX.UI.Menu.Opened[i] ~= nil then - if ESX.UI.Menu.Opened[i].type == type and ESX.UI.Menu.Opened[i].namespace == namespace and ESX.UI.Menu.Opened[i].name == name then - ESX.UI.Menu.Opened[i] = nil - end - end + menu.type = type + menu.namespace = namespace + menu.name = name + menu.data = data + menu.submit = submit + menu.cancel = cancel + menu.change = change - end + menu.close = function() - if close ~= nil then - close() - end + ESX.UI.Menu.RegisteredTypes[type].close(namespace, name) - end + for i=1, #ESX.UI.Menu.Opened, 1 do - menu.update = function(query, newData) + if ESX.UI.Menu.Opened[i] ~= nil then + if ESX.UI.Menu.Opened[i].type == type and ESX.UI.Menu.Opened[i].namespace == namespace and ESX.UI.Menu.Opened[i].name == name then + ESX.UI.Menu.Opened[i] = nil + end + end - for i=1, #menu.data.elements, 1 do - - local match = true + end - for k,v in pairs(query) do - if menu.data.elements[i][k] ~= v then - match = false - end - end + if close ~= nil then + close() + end - if match then - for k,v in pairs(newData) do - menu.data.elements[i][k] = v - end - end + end - end + menu.update = function(query, newData) - end + for i=1, #menu.data.elements, 1 do - menu.refresh = function() - ESX.UI.Menu.RegisteredTypes[type].open(namespace, name, menu.data) - end + local match = true - menu.setElement = function(i, key, val) - menu.data.elements[i][key] = val - end + for k,v in pairs(query) do + if menu.data.elements[i][k] ~= v then + match = false + end + end - table.insert(ESX.UI.Menu.Opened, menu) + if match then + for k,v in pairs(newData) do + menu.data.elements[i][k] = v + end + end - ESX.UI.Menu.RegisteredTypes[type].open(namespace, name, data) + end - return menu + end + + menu.refresh = function() + ESX.UI.Menu.RegisteredTypes[type].open(namespace, name, menu.data) + end + + menu.setElement = function(i, key, val) + menu.data.elements[i][key] = val + end + + table.insert(ESX.UI.Menu.Opened, menu) + + ESX.UI.Menu.RegisteredTypes[type].open(namespace, name, data) + + return menu end ESX.UI.Menu.Close = function(type, namespace, name) - - for i=1, #ESX.UI.Menu.Opened, 1 do - if ESX.UI.Menu.Opened[i] ~= nil then - if ESX.UI.Menu.Opened[i].type == type and ESX.UI.Menu.Opened[i].namespace == namespace and ESX.UI.Menu.Opened[i].name == name then - ESX.UI.Menu.Opened[i].close() - ESX.UI.Menu.Opened[i] = nil - end - end - end + + for i=1, #ESX.UI.Menu.Opened, 1 do + if ESX.UI.Menu.Opened[i] ~= nil then + if ESX.UI.Menu.Opened[i].type == type and ESX.UI.Menu.Opened[i].namespace == namespace and ESX.UI.Menu.Opened[i].name == name then + ESX.UI.Menu.Opened[i].close() + ESX.UI.Menu.Opened[i] = nil + end + end + end end ESX.UI.Menu.CloseAll = function() - - for i=1, #ESX.UI.Menu.Opened, 1 do - if ESX.UI.Menu.Opened[i] ~= nil then - ESX.UI.Menu.Opened[i].close() - ESX.UI.Menu.Opened[i] = nil - end - end + + for i=1, #ESX.UI.Menu.Opened, 1 do + if ESX.UI.Menu.Opened[i] ~= nil then + ESX.UI.Menu.Opened[i].close() + ESX.UI.Menu.Opened[i] = nil + end + end end ESX.UI.Menu.GetOpened = function(type, namespace, name) - for i=1, #ESX.UI.Menu.Opened, 1 do - if ESX.UI.Menu.Opened[i] ~= nil then - if ESX.UI.Menu.Opened[i].type == type and ESX.UI.Menu.Opened[i].namespace == namespace and ESX.UI.Menu.Opened[i].name == name then - return ESX.UI.Menu.Opened[i] - end - end - end + for i=1, #ESX.UI.Menu.Opened, 1 do + if ESX.UI.Menu.Opened[i] ~= nil then + if ESX.UI.Menu.Opened[i].type == type and ESX.UI.Menu.Opened[i].namespace == namespace and ESX.UI.Menu.Opened[i].name == name then + return ESX.UI.Menu.Opened[i] + end + end + end end ESX.UI.Menu.IsOpen = function(type, namespace, name) - return ESX.UI.Menu.GetOpened(type, namespace, name) ~= nil + return ESX.UI.Menu.GetOpened(type, namespace, name) ~= nil end ESX.UI.ShowInventoryItemNotification = function(add, item, count) - SendNUIMessage({ - action = 'inventoryNotification', - add = add, - item = item, - count = count - }) + SendNUIMessage({ + action = 'inventoryNotification', + add = add, + item = item, + count = count + }) end ESX.GetWeaponList = function() - return Config.Weapons + return Config.Weapons end ESX.GetWeaponLabel = function(name) - - name = string.upper(name) - local weapons = ESX.GetWeaponList() - - for i=1, #weapons, 1 do - if weapons[i].name == name then - return weapons[i].label - end - end + + name = string.upper(name) + local weapons = ESX.GetWeaponList() + + for i=1, #weapons, 1 do + if weapons[i].name == name then + return weapons[i].label + end + end end ESX.Game.Teleport = function(entity, coords, cb) - - RequestCollisionAtCoord(coords.x, coords.y, coords.z) - - while not HasCollisionLoadedAroundEntity(entity) do - RequestCollisionAtCoord(coords.x, coords.x, coords.x) - Citizen.Wait(0) - end - SetEntityCoords(entity, coords.x, coords.y, coords.z) + RequestCollisionAtCoord(coords.x, coords.y, coords.z) - if cb ~= nil then - cb() - end + while not HasCollisionLoadedAroundEntity(entity) do + RequestCollisionAtCoord(coords.x, coords.x, coords.x) + Citizen.Wait(0) + end + + SetEntityCoords(entity, coords.x, coords.y, coords.z) + + if cb ~= nil then + cb() + end end ESX.Game.SpawnObject = function(model, coords, cb) - local model = (type(model) == 'number' and model or GetHashKey(model)) + local model = (type(model) == 'number' and model or GetHashKey(model)) - Citizen.CreateThread(function() + Citizen.CreateThread(function() - RequestModel(model) + RequestModel(model) - while not HasModelLoaded(model) do - Citizen.Wait(0) - end + while not HasModelLoaded(model) do + Citizen.Wait(0) + end - local obj = CreateObject(model, coords.x, coords.y, coords.z, true, true, true) + local obj = CreateObject(model, coords.x, coords.y, coords.z, true, true, true) - if cb ~= nil then - cb(obj) - end + if cb ~= nil then + cb(obj) + end - end) + end) end ESX.Game.SpawnLocalObject = function(model, coords, cb) - local model = (type(model) == 'number' and model or GetHashKey(model)) + local model = (type(model) == 'number' and model or GetHashKey(model)) - Citizen.CreateThread(function() + Citizen.CreateThread(function() - RequestModel(model) + RequestModel(model) - while not HasModelLoaded(model) do - Citizen.Wait(0) - end + while not HasModelLoaded(model) do + Citizen.Wait(0) + end - local obj = CreateObject(model, coords.x, coords.y, coords.z, false, true, true) + local obj = CreateObject(model, coords.x, coords.y, coords.z, false, true, true) - if cb ~= nil then - cb(obj) - end + if cb ~= nil then + cb(obj) + end - end) + end) end ESX.Game.DeleteVehicle = function(vehicle) - SetEntityAsMissionEntity(vehicle, false, true) - DeleteVehicle(vehicle) + SetEntityAsMissionEntity(vehicle, false, true) + DeleteVehicle(vehicle) end ESX.Game.DeleteObject = function(object) - SetEntityAsMissionEntity(object, false, true) - DeleteObject(object) + SetEntityAsMissionEntity(object, false, true) + DeleteObject(object) end ESX.Game.SpawnVehicle = function(modelName, coords, heading, cb) local model = (type(modelName) == 'number' and modelName or GetHashKey(modelName)) - Citizen.CreateThread(function() + Citizen.CreateThread(function() - RequestModel(model) + RequestModel(model) - while not HasModelLoaded(model) do - Citizen.Wait(0) - end + while not HasModelLoaded(model) do + Citizen.Wait(0) + end - local vehicle = CreateVehicle(model, coords.x, coords.y, coords.z, heading, true, false) - local id = NetworkGetNetworkIdFromEntity(vehicle) + local vehicle = CreateVehicle(model, coords.x, coords.y, coords.z, heading, true, false) + local id = NetworkGetNetworkIdFromEntity(vehicle) - SetNetworkIdCanMigrate(id, true) - SetEntityAsMissionEntity(vehicle, true, false) - SetVehicleHasBeenOwnedByPlayer(vehicle, true) - SetModelAsNoLongerNeeded(model) + SetNetworkIdCanMigrate(id, true) + SetEntityAsMissionEntity(vehicle, true, false) + SetVehicleHasBeenOwnedByPlayer(vehicle, true) + SetModelAsNoLongerNeeded(model) - RequestCollisionAtCoord(coords.x, coords.y, coords.z) - - while not HasCollisionLoadedAroundEntity(vehicle) do - RequestCollisionAtCoord(coords.x, coords.x, coords.x) - Citizen.Wait(0) - end + RequestCollisionAtCoord(coords.x, coords.y, coords.z) - if cb ~= nil then - cb(vehicle) - end + while not HasCollisionLoadedAroundEntity(vehicle) do + RequestCollisionAtCoord(coords.x, coords.x, coords.x) + Citizen.Wait(0) + end - end) + if cb ~= nil then + cb(vehicle) + end + + end) end @@ -401,632 +401,632 @@ ESX.Game.SpawnLocalVehicle = function(modelName, coords, heading, cb) local model = (type(modelName) == 'number' and modelName or GetHashKey(modelName)) - Citizen.CreateThread(function() + Citizen.CreateThread(function() - RequestModel(model) + RequestModel(model) - while not HasModelLoaded(model) do - Citizen.Wait(0) - end + while not HasModelLoaded(model) do + Citizen.Wait(0) + end - local vehicle = CreateVehicle(model, coords.x, coords.y, coords.z, heading, false, false) + local vehicle = CreateVehicle(model, coords.x, coords.y, coords.z, heading, false, false) - SetEntityAsMissionEntity(vehicle, true, false) - SetVehicleHasBeenOwnedByPlayer(vehicle, true) - SetModelAsNoLongerNeeded(model) + SetEntityAsMissionEntity(vehicle, true, false) + SetVehicleHasBeenOwnedByPlayer(vehicle, true) + SetModelAsNoLongerNeeded(model) - RequestCollisionAtCoord(coords.x, coords.y, coords.z) - - while not HasCollisionLoadedAroundEntity(vehicle) do - RequestCollisionAtCoord(coords.x, coords.x, coords.x) - Citizen.Wait(0) - end + RequestCollisionAtCoord(coords.x, coords.y, coords.z) - if cb ~= nil then - cb(vehicle) - end + while not HasCollisionLoadedAroundEntity(vehicle) do + RequestCollisionAtCoord(coords.x, coords.x, coords.x) + Citizen.Wait(0) + end - end) + if cb ~= nil then + cb(vehicle) + end + + end) end ESX.Game.GetObjects = function() - local objects = {} + local objects = {} - for object in EnumerateObjects() do - table.insert(objects, object) - end + for object in EnumerateObjects() do + table.insert(objects, object) + end - return objects + return objects end ESX.Game.GetClosestObject = function(filter, coords) - - local objects = ESX.Game.GetObjects() - local closestDistance = -1 - local closestObject = -1 - local filter = filter - local coords = coords - if type(filter) == 'string' then - if filter ~= '' then - filter = {filter} - end - end + local objects = ESX.Game.GetObjects() + local closestDistance = -1 + local closestObject = -1 + local filter = filter + local coords = coords - if coords == nil then - local playerPed = GetPlayerPed(-1) - coords = GetEntityCoords(playerPed) - end + if type(filter) == 'string' then + if filter ~= '' then + filter = {filter} + end + end - for i=1, #objects, 1 do - - local foundObject = false + if coords == nil then + local playerPed = GetPlayerPed(-1) + coords = GetEntityCoords(playerPed) + end - if filter == nil or (type(filter) == 'table' and #filter == 0) then - foundObject = true - else + for i=1, #objects, 1 do - local objectModel = GetEntityModel(objects[i]) + local foundObject = false - for j=1, #filter, 1 do - if objectModel == GetHashKey(filter[j]) then - foundObject = true - end - end + if filter == nil or (type(filter) == 'table' and #filter == 0) then + foundObject = true + else - end + local objectModel = GetEntityModel(objects[i]) - if foundObject then + for j=1, #filter, 1 do + if objectModel == GetHashKey(filter[j]) then + foundObject = true + end + end - local objectCoords = GetEntityCoords(objects[i]) - local distance = GetDistanceBetweenCoords(objectCoords.x, objectCoords.y, objectCoords.z, coords.x, coords.y, coords.z, true) - - if closestDistance == -1 or closestDistance > distance then - closestObject = objects[i] - closestDistance = distance - end + end - end + if foundObject then - end - - return closestObject, closestDistance + local objectCoords = GetEntityCoords(objects[i]) + local distance = GetDistanceBetweenCoords(objectCoords.x, objectCoords.y, objectCoords.z, coords.x, coords.y, coords.z, true) + + if closestDistance == -1 or closestDistance > distance then + closestObject = objects[i] + closestDistance = distance + end + + end + + end + + return closestObject, closestDistance end ESX.Game.GetPlayers = function() - - local maxPlayers = Config.MaxPlayers - local players = {} - for i=0, maxPlayers, 1 do + local maxPlayers = Config.MaxPlayers + local players = {} - local ped = GetPlayerPed(i) + for i=0, maxPlayers, 1 do - if DoesEntityExist(ped) then - table.insert(players, i) - end - end + local ped = GetPlayerPed(i) - return players + if DoesEntityExist(ped) then + table.insert(players, i) + end + end + + return players end ESX.Game.GetClosestPlayer = function(coords) - - local players = ESX.Game.GetPlayers() - local closestDistance = -1 - local closestPlayer = -1 - local coords = coords - local usePlayerPed = false - local playerPed = GetPlayerPed(-1) - local playerId = PlayerId() - if coords == nil then - usePlayerPed = true - coords = GetEntityCoords(playerPed) - end + local players = ESX.Game.GetPlayers() + local closestDistance = -1 + local closestPlayer = -1 + local coords = coords + local usePlayerPed = false + local playerPed = GetPlayerPed(-1) + local playerId = PlayerId() - for i=1, #players, 1 do - - local target = GetPlayerPed(players[i]) - - if not usePlayerPed or (usePlayerPed and players[i] ~= playerId) then - - local targetCoords = GetEntityCoords(target) - local distance = GetDistanceBetweenCoords(targetCoords.x, targetCoords.y, targetCoords.z, coords.x, coords.y, coords.z, true) - - if closestDistance == -1 or closestDistance > distance then - closestPlayer = players[i] - closestDistance = distance - end + if coords == nil then + usePlayerPed = true + coords = GetEntityCoords(playerPed) + end - end + for i=1, #players, 1 do - end - - return closestPlayer, closestDistance + local target = GetPlayerPed(players[i]) + + if not usePlayerPed or (usePlayerPed and players[i] ~= playerId) then + + local targetCoords = GetEntityCoords(target) + local distance = GetDistanceBetweenCoords(targetCoords.x, targetCoords.y, targetCoords.z, coords.x, coords.y, coords.z, true) + + if closestDistance == -1 or closestDistance > distance then + closestPlayer = players[i] + closestDistance = distance + end + + end + + end + + return closestPlayer, closestDistance end ESX.Game.GetPlayersInArea = function(coords, area) - - local players = ESX.Game.GetPlayers() - local playersInArea = {} - - for i=1, #players, 1 do - - local target = GetPlayerPed(players[i]) - local targetCoords = GetEntityCoords(target) - local distance = GetDistanceBetweenCoords(targetCoords.x, targetCoords.y, targetCoords.z, coords.x, coords.y, coords.z, true) - if distance <= area then - table.insert(playersInArea, players[i]) - end + local players = ESX.Game.GetPlayers() + local playersInArea = {} - end - - return playersInArea + for i=1, #players, 1 do + + local target = GetPlayerPed(players[i]) + local targetCoords = GetEntityCoords(target) + local distance = GetDistanceBetweenCoords(targetCoords.x, targetCoords.y, targetCoords.z, coords.x, coords.y, coords.z, true) + + if distance <= area then + table.insert(playersInArea, players[i]) + end + + end + + return playersInArea end ESX.Game.GetVehicles = function() - local vehicles = {} + local vehicles = {} - for vehicle in EnumerateVehicles() do - table.insert(vehicles, vehicle) - end + for vehicle in EnumerateVehicles() do + table.insert(vehicles, vehicle) + end - return vehicles + return vehicles end ESX.Game.GetClosestVehicle = function(coords) - - local vehicles = ESX.Game.GetVehicles() - local closestDistance = -1 - local closestVehicle = -1 - local coords = coords - if coords == nil then - local playerPed = GetPlayerPed(-1) - coords = GetEntityCoords(playerPed) - end + local vehicles = ESX.Game.GetVehicles() + local closestDistance = -1 + local closestVehicle = -1 + local coords = coords - for i=1, #vehicles, 1 do - - local vehicleCoords = GetEntityCoords(vehicles[i]) - local distance = GetDistanceBetweenCoords(vehicleCoords.x, vehicleCoords.y, vehicleCoords.z, coords.x, coords.y, coords.z, true) - - if closestDistance == -1 or closestDistance > distance then - closestVehicle = vehicles[i] - closestDistance = distance - end + if coords == nil then + local playerPed = GetPlayerPed(-1) + coords = GetEntityCoords(playerPed) + end - end - - return closestVehicle, closestDistance + for i=1, #vehicles, 1 do + + local vehicleCoords = GetEntityCoords(vehicles[i]) + local distance = GetDistanceBetweenCoords(vehicleCoords.x, vehicleCoords.y, vehicleCoords.z, coords.x, coords.y, coords.z, true) + + if closestDistance == -1 or closestDistance > distance then + closestVehicle = vehicles[i] + closestDistance = distance + end + + end + + return closestVehicle, closestDistance end ESX.Game.GetVehiclesInArea = function(coords, area) - - local vehicles = ESX.Game.GetVehicles() - local vehiclesInArea = {} - - for i=1, #vehicles, 1 do - - local vehicleCoords = GetEntityCoords(vehicles[i]) - local distance = GetDistanceBetweenCoords(vehicleCoords.x, vehicleCoords.y, vehicleCoords.z, coords.x, coords.y, coords.z, true) - if distance <= area then - table.insert(vehiclesInArea, vehicles[i]) - end + local vehicles = ESX.Game.GetVehicles() + local vehiclesInArea = {} - end - - return vehiclesInArea + for i=1, #vehicles, 1 do + + local vehicleCoords = GetEntityCoords(vehicles[i]) + local distance = GetDistanceBetweenCoords(vehicleCoords.x, vehicleCoords.y, vehicleCoords.z, coords.x, coords.y, coords.z, true) + + if distance <= area then + table.insert(vehiclesInArea, vehicles[i]) + end + + end + + return vehiclesInArea end ESX.Game.GetPeds = function(ignoreList) - - local ignoreList = ignoreList or {} - local peds = {} - for ped in EnumeratePeds() do - - local found = false + local ignoreList = ignoreList or {} + local peds = {} - for j=1, #ignoreList, 1 do - if ignoreList[j] == ped then - found = true - end - end + for ped in EnumeratePeds() do - if not found then - table.insert(peds, ped) - end + local found = false - end + for j=1, #ignoreList, 1 do + if ignoreList[j] == ped then + found = true + end + end - return peds + if not found then + table.insert(peds, ped) + end + + end + + return peds end ESX.Game.GetClosestPed = function(coords, ignoreList) - local ignoreList = ignoreList or {} - local peds = ESX.Game.GetPeds(ignoreList) - local closestDistance = -1 - local closestPed = -1 + local ignoreList = ignoreList or {} + local peds = ESX.Game.GetPeds(ignoreList) + local closestDistance = -1 + local closestPed = -1 - for i=1, #peds, 1 do - - local pedCoords = GetEntityCoords(peds[i]) - local distance = GetDistanceBetweenCoords(pedCoords.x, pedCoords.y, pedCoords.z, coords.x, coords.y, coords.z, true) - - if closestDistance == -1 or closestDistance > distance then - closestPed = peds[i] - closestDistance = distance - end + for i=1, #peds, 1 do - end - - return closestPed, closestDistance + local pedCoords = GetEntityCoords(peds[i]) + local distance = GetDistanceBetweenCoords(pedCoords.x, pedCoords.y, pedCoords.z, coords.x, coords.y, coords.z, true) + + if closestDistance == -1 or closestDistance > distance then + closestPed = peds[i] + closestDistance = distance + end + + end + + return closestPed, closestDistance end ESX.Game.GetVehicleProperties = function(vehicle) - local color1, color2 = GetVehicleColours(vehicle) - local pearlescentColor, wheelColor = GetVehicleExtraColours(vehicle) - - return { - - model = GetEntityModel(vehicle), - - plate = GetVehicleNumberPlateText(vehicle), - plateIndex = GetVehicleNumberPlateTextIndex(vehicle), + local color1, color2 = GetVehicleColours(vehicle) + local pearlescentColor, wheelColor = GetVehicleExtraColours(vehicle) - health = GetEntityHealth(vehicle), - dirtLevel = GetVehicleDirtLevel(vehicle), + return { - color1 = color1, - color2 = color2, + model = GetEntityModel(vehicle), - pearlescentColor = pearlescentColor, - wheelColor = wheelColor, - - wheels = GetVehicleWheelType(vehicle), - windowTint = GetVehicleWindowTint(vehicle), - - neonEnabled = { - IsVehicleNeonLightEnabled(vehicle, 0), - IsVehicleNeonLightEnabled(vehicle, 1), - IsVehicleNeonLightEnabled(vehicle, 2), - IsVehicleNeonLightEnabled(vehicle, 3), - }, + plate = GetVehicleNumberPlateText(vehicle), + plateIndex = GetVehicleNumberPlateTextIndex(vehicle), - neonColor = table.pack(GetVehicleNeonLightsColour(vehicle)), - tyreSmokeColor = table.pack(GetVehicleTyreSmokeColor(vehicle)), - - modSpoilers = GetVehicleMod(vehicle, 0), - modFrontBumper = GetVehicleMod(vehicle, 1), - modRearBumper = GetVehicleMod(vehicle, 2), - modSideSkirt = GetVehicleMod(vehicle, 3), - modExhaust = GetVehicleMod(vehicle, 4), - modFrame = GetVehicleMod(vehicle, 5), - modGrille = GetVehicleMod(vehicle, 6), - modHood = GetVehicleMod(vehicle, 7), - modFender = GetVehicleMod(vehicle, 8), - modRightFender = GetVehicleMod(vehicle, 9), - modRoof = GetVehicleMod(vehicle, 10), + health = GetEntityHealth(vehicle), + dirtLevel = GetVehicleDirtLevel(vehicle), - modEngine = GetVehicleMod(vehicle, 11), - modBrakes = GetVehicleMod(vehicle, 12), - modTransmission = GetVehicleMod(vehicle, 13), - modHorns = GetVehicleMod(vehicle, 14), - modSuspension = GetVehicleMod(vehicle, 15), - modArmor = GetVehicleMod(vehicle, 16), + color1 = color1, + color2 = color2, - modTurbo = IsToggleModOn(vehicle, 18), - modSmokeEnabled = IsToggleModOn(vehicle, 20), - modXenon = IsToggleModOn(vehicle, 22), + pearlescentColor = pearlescentColor, + wheelColor = wheelColor, - modFrontWheels = GetVehicleMod(vehicle, 23), - modBackWheels = GetVehicleMod(vehicle, 24), + wheels = GetVehicleWheelType(vehicle), + windowTint = GetVehicleWindowTint(vehicle), - modPlateHolder = GetVehicleMod(vehicle, 25), - modVanityPlate = GetVehicleMod(vehicle, 26), - modTrimA = GetVehicleMod(vehicle, 27), - modOrnaments = GetVehicleMod(vehicle, 28), - modDashboard = GetVehicleMod(vehicle, 29), - modDial = GetVehicleMod(vehicle, 30), - modDoorSpeaker = GetVehicleMod(vehicle, 31), - modSeats = GetVehicleMod(vehicle, 32), - modSteeringWheel = GetVehicleMod(vehicle, 33), - modShifterLeavers = GetVehicleMod(vehicle, 34), - modAPlate = GetVehicleMod(vehicle, 35), - modSpeakers = GetVehicleMod(vehicle, 36), - modTrunk = GetVehicleMod(vehicle, 37), - modHydrolic = GetVehicleMod(vehicle, 38), - modEngineBlock = GetVehicleMod(vehicle, 39), - modAirFilter = GetVehicleMod(vehicle, 40), - modStruts = GetVehicleMod(vehicle, 41), - modArchCover = GetVehicleMod(vehicle, 42), - modAerials = GetVehicleMod(vehicle, 43), - modTrimB = GetVehicleMod(vehicle, 44), - modTank = GetVehicleMod(vehicle, 45), - modWindows = GetVehicleMod(vehicle, 46), - modLivery = GetVehicleMod(vehicle, 48) - } + neonEnabled = { + IsVehicleNeonLightEnabled(vehicle, 0), + IsVehicleNeonLightEnabled(vehicle, 1), + IsVehicleNeonLightEnabled(vehicle, 2), + IsVehicleNeonLightEnabled(vehicle, 3), + }, + + neonColor = table.pack(GetVehicleNeonLightsColour(vehicle)), + tyreSmokeColor = table.pack(GetVehicleTyreSmokeColor(vehicle)), + + modSpoilers = GetVehicleMod(vehicle, 0), + modFrontBumper = GetVehicleMod(vehicle, 1), + modRearBumper = GetVehicleMod(vehicle, 2), + modSideSkirt = GetVehicleMod(vehicle, 3), + modExhaust = GetVehicleMod(vehicle, 4), + modFrame = GetVehicleMod(vehicle, 5), + modGrille = GetVehicleMod(vehicle, 6), + modHood = GetVehicleMod(vehicle, 7), + modFender = GetVehicleMod(vehicle, 8), + modRightFender = GetVehicleMod(vehicle, 9), + modRoof = GetVehicleMod(vehicle, 10), + + modEngine = GetVehicleMod(vehicle, 11), + modBrakes = GetVehicleMod(vehicle, 12), + modTransmission = GetVehicleMod(vehicle, 13), + modHorns = GetVehicleMod(vehicle, 14), + modSuspension = GetVehicleMod(vehicle, 15), + modArmor = GetVehicleMod(vehicle, 16), + + modTurbo = IsToggleModOn(vehicle, 18), + modSmokeEnabled = IsToggleModOn(vehicle, 20), + modXenon = IsToggleModOn(vehicle, 22), + + modFrontWheels = GetVehicleMod(vehicle, 23), + modBackWheels = GetVehicleMod(vehicle, 24), + + modPlateHolder = GetVehicleMod(vehicle, 25), + modVanityPlate = GetVehicleMod(vehicle, 26), + modTrimA = GetVehicleMod(vehicle, 27), + modOrnaments = GetVehicleMod(vehicle, 28), + modDashboard = GetVehicleMod(vehicle, 29), + modDial = GetVehicleMod(vehicle, 30), + modDoorSpeaker = GetVehicleMod(vehicle, 31), + modSeats = GetVehicleMod(vehicle, 32), + modSteeringWheel = GetVehicleMod(vehicle, 33), + modShifterLeavers = GetVehicleMod(vehicle, 34), + modAPlate = GetVehicleMod(vehicle, 35), + modSpeakers = GetVehicleMod(vehicle, 36), + modTrunk = GetVehicleMod(vehicle, 37), + modHydrolic = GetVehicleMod(vehicle, 38), + modEngineBlock = GetVehicleMod(vehicle, 39), + modAirFilter = GetVehicleMod(vehicle, 40), + modStruts = GetVehicleMod(vehicle, 41), + modArchCover = GetVehicleMod(vehicle, 42), + modAerials = GetVehicleMod(vehicle, 43), + modTrimB = GetVehicleMod(vehicle, 44), + modTank = GetVehicleMod(vehicle, 45), + modWindows = GetVehicleMod(vehicle, 46), + modLivery = GetVehicleMod(vehicle, 48) + } end ESX.Game.SetVehicleProperties = function(vehicle, props) - SetVehicleModKit(vehicle, 0) + SetVehicleModKit(vehicle, 0) - if props.plate ~= nil then - SetVehicleNumberPlateText(vehicle, props.plate) - end + if props.plate ~= nil then + SetVehicleNumberPlateText(vehicle, props.plate) + end - if props.plateIndex ~= nil then - SetVehicleNumberPlateTextIndex(vehicle, props.plateIndex) - end + if props.plateIndex ~= nil then + SetVehicleNumberPlateTextIndex(vehicle, props.plateIndex) + end - if props.health ~= nil then - SetEntityHealth(vehicle, props.health) - end + if props.health ~= nil then + SetEntityHealth(vehicle, props.health) + end - if props.dirtLevel ~= nil then - SetVehicleDirtLevel(vehicle, props.dirtLevel) - end + if props.dirtLevel ~= nil then + SetVehicleDirtLevel(vehicle, props.dirtLevel) + end - if props.color1 ~= nil then - local color1, color2 = GetVehicleColours(vehicle) - SetVehicleColours(vehicle, props.color1, color2) - end + if props.color1 ~= nil then + local color1, color2 = GetVehicleColours(vehicle) + SetVehicleColours(vehicle, props.color1, color2) + end - if props.color2 ~= nil then - local color1, color2 = GetVehicleColours(vehicle) - SetVehicleColours(vehicle, color1, props.color2) - end + if props.color2 ~= nil then + local color1, color2 = GetVehicleColours(vehicle) + SetVehicleColours(vehicle, color1, props.color2) + end - if props.pearlescentColor ~= nil then - local pearlescentColor, wheelColor = GetVehicleExtraColours(vehicle) - SetVehicleExtraColours(vehicle, props.pearlescentColor, wheelColor) - end + if props.pearlescentColor ~= nil then + local pearlescentColor, wheelColor = GetVehicleExtraColours(vehicle) + SetVehicleExtraColours(vehicle, props.pearlescentColor, wheelColor) + end - if props.wheelColor ~= nil then - local pearlescentColor, wheelColor = GetVehicleExtraColours(vehicle) - SetVehicleExtraColours(vehicle, pearlescentColor, props.wheelColor) - end + if props.wheelColor ~= nil then + local pearlescentColor, wheelColor = GetVehicleExtraColours(vehicle) + SetVehicleExtraColours(vehicle, pearlescentColor, props.wheelColor) + end - if props.wheels ~= nil then - SetVehicleWheelType(vehicle, props.wheels) - end + if props.wheels ~= nil then + SetVehicleWheelType(vehicle, props.wheels) + end - if props.windowTint ~= nil then - SetVehicleWindowTint(vehicle, props.windowTint) - end + if props.windowTint ~= nil then + SetVehicleWindowTint(vehicle, props.windowTint) + 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.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.neonColor ~= nil then - SetVehicleNeonLightsColour(vehicle, props.neonColor[1], props.neonColor[2], props.neonColor[3]) - end + if props.neonColor ~= nil then + SetVehicleNeonLightsColour(vehicle, props.neonColor[1], props.neonColor[2], props.neonColor[3]) + end - if props.modSmokeEnabled ~= nil then - ToggleVehicleMod(vehicle, 20, true) - 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.tyreSmokeColor ~= nil then + SetVehicleTyreSmokeColor(vehicle, props.tyreSmokeColor[1], props.tyreSmokeColor[2], props.tyreSmokeColor[3]) + end - if props.modFrontBumper ~= nil then - SetVehicleMod(vehicle, 1, props.modFrontBumper, false) - end + if props.modSpoilers ~= nil then + SetVehicleMod(vehicle, 0, props.modSpoilers, false) + end - if props.modRearBumper ~= nil then - SetVehicleMod(vehicle, 2, props.modRearBumper, false) - end + if props.modFrontBumper ~= nil then + SetVehicleMod(vehicle, 1, props.modFrontBumper, false) + end - if props.modSideSkirt ~= nil then - SetVehicleMod(vehicle, 3, props.modSideSkirt, false) - end + if props.modRearBumper ~= nil then + SetVehicleMod(vehicle, 2, props.modRearBumper, false) + end - if props.modExhaust ~= nil then - SetVehicleMod(vehicle, 4, props.modExhaust, false) - end + if props.modSideSkirt ~= nil then + SetVehicleMod(vehicle, 3, props.modSideSkirt, false) + end - if props.modFrame ~= nil then - SetVehicleMod(vehicle, 5, props.modFrame, false) - end + if props.modExhaust ~= nil then + SetVehicleMod(vehicle, 4, props.modExhaust, false) + end - if props.modGrille ~= nil then - SetVehicleMod(vehicle, 6, props.modGrille, false) - end + if props.modFrame ~= nil then + SetVehicleMod(vehicle, 5, props.modFrame, false) + end - if props.modHood ~= nil then - SetVehicleMod(vehicle, 7, props.modHood, false) - end + if props.modGrille ~= nil then + SetVehicleMod(vehicle, 6, props.modGrille, false) + end - if props.modFender ~= nil then - SetVehicleMod(vehicle, 8, props.modFender, false) - end + if props.modHood ~= nil then + SetVehicleMod(vehicle, 7, props.modHood, false) + end - if props.modRightFender ~= nil then - SetVehicleMod(vehicle, 9, props.modRightFender, false) - end + if props.modFender ~= nil then + SetVehicleMod(vehicle, 8, props.modFender, false) + end - if props.modRoof ~= nil then - SetVehicleMod(vehicle, 10, props.modRoof, false) - end + if props.modRightFender ~= nil then + SetVehicleMod(vehicle, 9, props.modRightFender, false) + end - if props.modEngine ~= nil then - SetVehicleMod(vehicle, 11, props.modEngine, false) - end + if props.modRoof ~= nil then + SetVehicleMod(vehicle, 10, props.modRoof, false) + end - if props.modBrakes ~= nil then - SetVehicleMod(vehicle, 12, props.modBrakes, false) - end + if props.modEngine ~= nil then + SetVehicleMod(vehicle, 11, props.modEngine, false) + end - if props.modTransmission ~= nil then - SetVehicleMod(vehicle, 13, props.modTransmission, false) - end + if props.modBrakes ~= nil then + SetVehicleMod(vehicle, 12, props.modBrakes, false) + end - if props.modHorns ~= nil then - SetVehicleMod(vehicle, 14, props.modHorns, false) - end + if props.modTransmission ~= nil then + SetVehicleMod(vehicle, 13, props.modTransmission, false) + end - if props.modSuspension ~= nil then - SetVehicleMod(vehicle, 15, props.modSuspension, false) - end + if props.modHorns ~= nil then + SetVehicleMod(vehicle, 14, props.modHorns, false) + end - if props.modArmor ~= nil then - SetVehicleMod(vehicle, 16, props.modArmor, false) - end + if props.modSuspension ~= nil then + SetVehicleMod(vehicle, 15, props.modSuspension, false) + end - if props.modTurbo ~= nil then - ToggleVehicleMod(vehicle, 18, props.modTurbo) - end + if props.modArmor ~= nil then + SetVehicleMod(vehicle, 16, props.modArmor, false) + end - if props.modXenon ~= nil then - ToggleVehicleMod(vehicle, 22, props.modXenon) - end + if props.modTurbo ~= nil then + ToggleVehicleMod(vehicle, 18, props.modTurbo) + end - if props.modFrontWheels ~= nil then - SetVehicleMod(vehicle, 23, props.modFrontWheels, false) - end + if props.modXenon ~= nil then + ToggleVehicleMod(vehicle, 22, props.modXenon) + end - if props.modBackWheels ~= nil then - SetVehicleMod(vehicle, 24, props.modBackWheels, false) - end + if props.modFrontWheels ~= nil then + SetVehicleMod(vehicle, 23, props.modFrontWheels, false) + end - if props.modPlateHolder ~= nil then - SetVehicleMod(vehicle, 25, props.modPlateHolder , false) - end + if props.modBackWheels ~= nil then + SetVehicleMod(vehicle, 24, props.modBackWheels, false) + end - if props.modVanityPlate ~= nil then - SetVehicleMod(vehicle, 26, props.modVanityPlate , false) - end + if props.modPlateHolder ~= nil then + SetVehicleMod(vehicle, 25, props.modPlateHolder , false) + end - if props.modTrimA ~= nil then - SetVehicleMod(vehicle, 27, props.modTrimA , false) - end + if props.modVanityPlate ~= nil then + SetVehicleMod(vehicle, 26, props.modVanityPlate , false) + end - if props.modOrnaments ~= nil then - SetVehicleMod(vehicle, 28, props.modOrnaments , false) - end + if props.modTrimA ~= nil then + SetVehicleMod(vehicle, 27, props.modTrimA , false) + end - if props.modDashboard ~= nil then - SetVehicleMod(vehicle, 29, props.modDashboard , false) - end + if props.modOrnaments ~= nil then + SetVehicleMod(vehicle, 28, props.modOrnaments , false) + end - if props.modDial ~= nil then - SetVehicleMod(vehicle, 30, props.modDial , false) - end + if props.modDashboard ~= nil then + SetVehicleMod(vehicle, 29, props.modDashboard , false) + end - if props.modDoorSpeaker ~= nil then - SetVehicleMod(vehicle, 31, props.modDoorSpeaker , false) - end + if props.modDial ~= nil then + SetVehicleMod(vehicle, 30, props.modDial , false) + end - if props.modSeats ~= nil then - SetVehicleMod(vehicle, 32, props.modSeats , false) - end + if props.modDoorSpeaker ~= nil then + SetVehicleMod(vehicle, 31, props.modDoorSpeaker , false) + end - if props.modSteeringWheel ~= nil then - SetVehicleMod(vehicle, 33, props.modSteeringWheel , false) - end + if props.modSeats ~= nil then + SetVehicleMod(vehicle, 32, props.modSeats , false) + end - if props.modShifterLeavers ~= nil then - SetVehicleMod(vehicle, 34, props.modShifterLeavers , false) - end + if props.modSteeringWheel ~= nil then + SetVehicleMod(vehicle, 33, props.modSteeringWheel , false) + end - if props.modAPlate ~= nil then - SetVehicleMod(vehicle, 35, props.modAPlate , false) - end + if props.modShifterLeavers ~= nil then + SetVehicleMod(vehicle, 34, props.modShifterLeavers , false) + end - if props.modSpeakers ~= nil then - SetVehicleMod(vehicle, 36, props.modSpeakers , false) - end + if props.modAPlate ~= nil then + SetVehicleMod(vehicle, 35, props.modAPlate , false) + end - if props.modTrunk ~= nil then - SetVehicleMod(vehicle, 37, props.modTrunk , false) - end + if props.modSpeakers ~= nil then + SetVehicleMod(vehicle, 36, props.modSpeakers , false) + end - if props.modHydrolic ~= nil then - SetVehicleMod(vehicle, 38, props.modHydrolic , false) - end + if props.modTrunk ~= nil then + SetVehicleMod(vehicle, 37, props.modTrunk , false) + end - if props.modEngineBlock ~= nil then - SetVehicleMod(vehicle, 39, props.modEngineBlock , false) - end + if props.modHydrolic ~= nil then + SetVehicleMod(vehicle, 38, props.modHydrolic , false) + end - if props.modAirFilter ~= nil then - SetVehicleMod(vehicle, 40, props.modAirFilter , false) - end + if props.modEngineBlock ~= nil then + SetVehicleMod(vehicle, 39, props.modEngineBlock , false) + end - if props.modStruts ~= nil then - SetVehicleMod(vehicle, 41, props.modStruts , false) - end + if props.modAirFilter ~= nil then + SetVehicleMod(vehicle, 40, props.modAirFilter , false) + end - if props.modArchCover ~= nil then - SetVehicleMod(vehicle, 42, props.modArchCover , false) - end + if props.modStruts ~= nil then + SetVehicleMod(vehicle, 41, props.modStruts , false) + end - if props.modAerials ~= nil then - SetVehicleMod(vehicle, 43, props.modAerials , false) - end + if props.modArchCover ~= nil then + SetVehicleMod(vehicle, 42, props.modArchCover , false) + end - if props.modTrimB ~= nil then - SetVehicleMod(vehicle, 44, props.modTrimB , false) - end + if props.modAerials ~= nil then + SetVehicleMod(vehicle, 43, props.modAerials , false) + end - if props.modTank ~= nil then - SetVehicleMod(vehicle, 45, props.modTank , false) - end + if props.modTrimB ~= nil then + SetVehicleMod(vehicle, 44, props.modTrimB , false) + end - if props.modWindows ~= nil then - SetVehicleMod(vehicle, 46, props.modWindows , false) - end - - if props.modLivery ~= nil then - SetVehicleMod(vehicle, 48, props.modLivery , 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 ~= nil then + SetVehicleMod(vehicle, 48, props.modLivery , false) + end end ESX.Game.Utils.DrawText3D = function(coords, text, size) - + local onScreen, x, y = World3dToScreen2d(coords.x, coords.y, coords.z) local camCoords = GetGameplayCamCoords() local dist = GetDistanceBetweenCoords(camCoords.x, camCoords.y, camCoords.z, coords.x, coords.y, coords.z, 1) local size = size if size == nil then - size = 1 + size = 1 end local scale = (size / dist) * 2 local fov = (1 / GetGameplayCamFov()) * 100 local scale = scale * fov - + if onScreen then - + SetTextScale(0.0 * scale, 0.55 * scale) SetTextFont(0) SetTextProportional(1) @@ -1037,9 +1037,9 @@ ESX.Game.Utils.DrawText3D = function(coords, text, size) SetTextOutline() SetTextEntry('STRING') SetTextCentre(1) - + AddTextComponentString(text) - + DrawText(x, y) end @@ -1047,239 +1047,239 @@ end ESX.ShowInventory = function() - local playerPed = GetPlayerPed(-1) - local elements = {} + local playerPed = GetPlayerPed(-1) + local elements = {} - table.insert(elements, { - label = '[Cash] $' .. ESX.PlayerData.money, - count = ESX.PlayerData.money, - type = 'item_money', - value = 'money', - usable = false, - rare = false, - canRemove = true - }) + table.insert(elements, { + label = '[Cash] $' .. ESX.PlayerData.money, + count = ESX.PlayerData.money, + type = 'item_money', + value = 'money', + usable = false, + rare = false, + canRemove = true + }) - for i=1, #ESX.PlayerData.accounts, 1 do - table.insert(elements, { - label = '[' .. ESX.PlayerData.accounts[i].label .. '] $' .. ESX.PlayerData.accounts[i].money, - count = ESX.PlayerData.accounts[i].money, - type = 'item_account', - value = ESX.PlayerData.accounts[i].name, - usable = false, - rare = false, - canRemove = true - }) - end + for i=1, #ESX.PlayerData.accounts, 1 do + table.insert(elements, { + label = '[' .. ESX.PlayerData.accounts[i].label .. '] $' .. ESX.PlayerData.accounts[i].money, + count = ESX.PlayerData.accounts[i].money, + type = 'item_account', + value = ESX.PlayerData.accounts[i].name, + usable = false, + rare = false, + canRemove = true + }) + end - for i=1, #ESX.PlayerData.inventory, 1 do + for i=1, #ESX.PlayerData.inventory, 1 do - if ESX.PlayerData.inventory[i].count > 0 then - table.insert(elements, { - label = ESX.PlayerData.inventory[i].label .. ' x' .. ESX.PlayerData.inventory[i].count, - count = ESX.PlayerData.inventory[i].count, - type = 'item_standard', - value = ESX.PlayerData.inventory[i].name, - usable = ESX.PlayerData.inventory[i].usable, - rare = ESX.PlayerData.inventory[i].rare, - canRemove = ESX.PlayerData.inventory[i].canRemove, - }) - end + if ESX.PlayerData.inventory[i].count > 0 then + table.insert(elements, { + label = ESX.PlayerData.inventory[i].label .. ' x' .. ESX.PlayerData.inventory[i].count, + count = ESX.PlayerData.inventory[i].count, + type = 'item_standard', + value = ESX.PlayerData.inventory[i].name, + usable = ESX.PlayerData.inventory[i].usable, + rare = ESX.PlayerData.inventory[i].rare, + canRemove = ESX.PlayerData.inventory[i].canRemove, + }) + end - end + end - for i=1, #Config.Weapons, 1 do - - local weaponHash = GetHashKey(Config.Weapons[i].name) + for i=1, #Config.Weapons, 1 do - if HasPedGotWeapon(playerPed, weaponHash, false) and Config.Weapons[i].name ~= 'WEAPON_UNARMED' then + local weaponHash = GetHashKey(Config.Weapons[i].name) - local ammo = GetAmmoInPedWeapon(playerPed, weaponHash) - - table.insert(elements, { - label = Config.Weapons[i].label .. ' x1 [' .. ammo .. ']', - count = 1, - type = 'item_weapon', - value = Config.Weapons[i].name, - usable = false, - rare = false, - canRemove = true - }) + if HasPedGotWeapon(playerPed, weaponHash, false) and Config.Weapons[i].name ~= 'WEAPON_UNARMED' then - end - end + local ammo = GetAmmoInPedWeapon(playerPed, weaponHash) - ESX.UI.Menu.CloseAll() + table.insert(elements, { + label = Config.Weapons[i].label .. ' x1 [' .. ammo .. ']', + count = 1, + type = 'item_weapon', + value = Config.Weapons[i].name, + usable = false, + rare = false, + canRemove = true + }) - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'inventory', - { - title = _U('inventory'), - align = 'bottom-right', - elements = elements, - }, - function(data, menu) + end + end - menu.close() + ESX.UI.Menu.CloseAll() - local elements = {} + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'inventory', + { + title = _U('inventory'), + align = 'bottom-right', + elements = elements, + }, + function(data, menu) - if data.current.usable then - table.insert(elements, {label = _U('use'), action = 'use', type = data.current.type, value = data.current.value}) - end + menu.close() - if data.current.canRemove then - table.insert(elements, {label = _U('give'), action = 'give', type = data.current.type, value = data.current.value}) - table.insert(elements, {label = _U('remove'), action = 'remove', type = data.current.type, value = data.current.value}) - end + local elements = {} - table.insert(elements, {label = _U('return'), action = 'return'}) + if data.current.usable then + table.insert(elements, {label = _U('use'), action = 'use', type = data.current.type, value = data.current.value}) + end - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'inventory_item', - { - title = _U('inventory'), - align = 'bottom-right', - elements = elements, - }, - function(data, menu) + if data.current.canRemove then + table.insert(elements, {label = _U('give'), action = 'give', type = data.current.type, value = data.current.value}) + table.insert(elements, {label = _U('remove'), action = 'remove', type = data.current.type, value = data.current.value}) + end - local item = data.current.value - local type = data.current.type + table.insert(elements, {label = _U('return'), action = 'return'}) - if data.current.action == 'give' then + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'inventory_item', + { + title = _U('inventory'), + align = 'bottom-right', + elements = elements, + }, + function(data, menu) - if type == 'item_weapon' then + local item = data.current.value + local type = data.current.type - local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() + if data.current.action == 'give' then - if closestPlayer == -1 or closestDistance > 3.0 then - ESX.ShowNotification(_U('players_nearby')) - else - TriggerServerEvent('esx:giveInventoryItem', GetPlayerServerId(closestPlayer), type, item, 1) - end + if type == 'item_weapon' then - else + local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() - ESX.UI.Menu.Open( - 'dialog', GetCurrentResourceName(), 'inventory_item_count_give', - { - title = _U('amount') - }, - function(data2, menu2) + if closestPlayer == -1 or closestDistance > 3.0 then + ESX.ShowNotification(_U('players_nearby')) + else + TriggerServerEvent('esx:giveInventoryItem', GetPlayerServerId(closestPlayer), type, item, 1) + end - local quantity = tonumber(data2.value) - local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() + else - if closestPlayer == -1 or closestDistance > 3.0 then - ESX.ShowNotification(_U('players_nearby')) - else - TriggerServerEvent('esx:giveInventoryItem', GetPlayerServerId(closestPlayer), type, item, quantity) - end + ESX.UI.Menu.Open( + 'dialog', GetCurrentResourceName(), 'inventory_item_count_give', + { + title = _U('amount') + }, + function(data2, menu2) - menu2.close() - menu.close() + local quantity = tonumber(data2.value) + local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() - end, - function(data2, menu2) - menu2.close() - end - ) + if closestPlayer == -1 or closestDistance > 3.0 then + ESX.ShowNotification(_U('players_nearby')) + else + TriggerServerEvent('esx:giveInventoryItem', GetPlayerServerId(closestPlayer), type, item, quantity) + end - end + menu2.close() + menu.close() - elseif data.current.action == 'remove' then + end, + function(data2, menu2) + menu2.close() + end + ) - if type == 'item_weapon' then - - TriggerServerEvent('esx:removeInventoryItem', type, item, 1) - menu.close() - - else + end - ESX.UI.Menu.Open( - 'dialog', GetCurrentResourceName(), 'inventory_item_count_remove', - { - title = _U('amount') - }, - function(data2, menu2) + elseif data.current.action == 'remove' then - local quantity = tonumber(data2.value) + if type == 'item_weapon' then - if quantity == nil then - ESX.ShowNotification(_U('amount_invalid')) - else - TriggerServerEvent('esx:removeInventoryItem', type, item, quantity) - end + TriggerServerEvent('esx:removeInventoryItem', type, item, 1) + menu.close() - menu2.close() - menu.close() - - end, - function(data2, menu2) - menu2.close() - end - ) + else - end + ESX.UI.Menu.Open( + 'dialog', GetCurrentResourceName(), 'inventory_item_count_remove', + { + title = _U('amount') + }, + function(data2, menu2) - elseif data.current.action == 'use' then + local quantity = tonumber(data2.value) - TriggerServerEvent('esx:useItem', data.current.value) + if quantity == nil then + ESX.ShowNotification(_U('amount_invalid')) + else + TriggerServerEvent('esx:removeInventoryItem', type, item, quantity) + end - elseif data.current.action == 'return' then - - ESX.UI.Menu.CloseAll() - ESX.ShowInventory() - - end - - end, - function(data, menu) - ESX.UI.Menu.CloseAll() - ESX.ShowInventory() - end - ) + menu2.close() + menu.close() - end, - function(data, menu) - menu.close() - end - ) + end, + function(data2, menu2) + menu2.close() + end + ) + + end + + elseif data.current.action == 'use' then + + TriggerServerEvent('esx:useItem', data.current.value) + + elseif data.current.action == 'return' then + + ESX.UI.Menu.CloseAll() + ESX.ShowInventory() + + end + + end, + function(data, menu) + ESX.UI.Menu.CloseAll() + ESX.ShowInventory() + end + ) + + end, + function(data, menu) + menu.close() + end + ) end RegisterNetEvent('esx:serverCallback') AddEventHandler('esx:serverCallback', function(requestId, ...) - ESX.ServerCallbacks[requestId](...) - ESX.ServerCallbacks[requestId] = nil + ESX.ServerCallbacks[requestId](...) + ESX.ServerCallbacks[requestId] = nil end) RegisterNetEvent('esx:showNotification') AddEventHandler('esx:showNotification', function(msg) - ESX.ShowNotification(msg) + ESX.ShowNotification(msg) end) -- SetTimeout Citizen.CreateThread(function() - while true do + while true do - Citizen.Wait(0) + Citizen.Wait(0) - local currTime = GetGameTimer() + local currTime = GetGameTimer() - for i=1, #ESX.TimeoutCallbacks, 1 do + for i=1, #ESX.TimeoutCallbacks, 1 do - if ESX.TimeoutCallbacks[i] ~= nil then + if ESX.TimeoutCallbacks[i] ~= nil then - if currTime >= ESX.TimeoutCallbacks[i].time then - ESX.TimeoutCallbacks[i].cb() - ESX.TimeoutCallbacks[i] = nil - end + if currTime >= ESX.TimeoutCallbacks[i].time then + ESX.TimeoutCallbacks[i].cb() + ESX.TimeoutCallbacks[i] = nil + end - end + end - end + end - end -end) \ No newline at end of file + end +end) diff --git a/resources/[essential]/es_extended/client/main.lua b/resources/[essential]/es_extended/client/main.lua index 8263a996..4b1e50ba 100644 --- a/resources/[essential]/es_extended/client/main.lua +++ b/resources/[essential]/es_extended/client/main.lua @@ -1,13 +1,13 @@ local Keys = { - ["ESC"] = 322, ["F1"] = 288, ["F2"] = 289, ["F3"] = 170, ["F5"] = 166, ["F6"] = 167, ["F7"] = 168, ["F8"] = 169, ["F9"] = 56, ["F10"] = 57, - ["~"] = 243, ["1"] = 157, ["2"] = 158, ["3"] = 160, ["4"] = 164, ["5"] = 165, ["6"] = 159, ["7"] = 161, ["8"] = 162, ["9"] = 163, ["-"] = 84, ["="] = 83, ["BACKSPACE"] = 177, - ["TAB"] = 37, ["Q"] = 44, ["W"] = 32, ["E"] = 38, ["R"] = 45, ["T"] = 245, ["Y"] = 246, ["U"] = 303, ["P"] = 199, ["["] = 39, ["]"] = 40, ["ENTER"] = 18, - ["CAPS"] = 137, ["A"] = 34, ["S"] = 8, ["D"] = 9, ["F"] = 23, ["G"] = 47, ["H"] = 74, ["K"] = 311, ["L"] = 182, - ["LEFTSHIFT"] = 21, ["Z"] = 20, ["X"] = 73, ["C"] = 26, ["V"] = 0, ["B"] = 29, ["N"] = 249, ["M"] = 244, [","] = 82, ["."] = 81, - ["LEFTCTRL"] = 36, ["LEFTALT"] = 19, ["SPACE"] = 22, ["RIGHTCTRL"] = 70, - ["HOME"] = 213, ["PAGEUP"] = 10, ["PAGEDOWN"] = 11, ["DELETE"] = 178, - ["LEFT"] = 174, ["RIGHT"] = 175, ["TOP"] = 27, ["DOWN"] = 173, - ["NENTER"] = 201, ["N4"] = 108, ["N5"] = 60, ["N6"] = 107, ["N+"] = 96, ["N-"] = 97, ["N7"] = 117, ["N8"] = 61, ["N9"] = 118 + ["ESC"] = 322, ["F1"] = 288, ["F2"] = 289, ["F3"] = 170, ["F5"] = 166, ["F6"] = 167, ["F7"] = 168, ["F8"] = 169, ["F9"] = 56, ["F10"] = 57, + ["~"] = 243, ["1"] = 157, ["2"] = 158, ["3"] = 160, ["4"] = 164, ["5"] = 165, ["6"] = 159, ["7"] = 161, ["8"] = 162, ["9"] = 163, ["-"] = 84, ["="] = 83, ["BACKSPACE"] = 177, + ["TAB"] = 37, ["Q"] = 44, ["W"] = 32, ["E"] = 38, ["R"] = 45, ["T"] = 245, ["Y"] = 246, ["U"] = 303, ["P"] = 199, ["["] = 39, ["]"] = 40, ["ENTER"] = 18, + ["CAPS"] = 137, ["A"] = 34, ["S"] = 8, ["D"] = 9, ["F"] = 23, ["G"] = 47, ["H"] = 74, ["K"] = 311, ["L"] = 182, + ["LEFTSHIFT"] = 21, ["Z"] = 20, ["X"] = 73, ["C"] = 26, ["V"] = 0, ["B"] = 29, ["N"] = 249, ["M"] = 244, [","] = 82, ["."] = 81, + ["LEFTCTRL"] = 36, ["LEFTALT"] = 19, ["SPACE"] = 22, ["RIGHTCTRL"] = 70, + ["HOME"] = 213, ["PAGEUP"] = 10, ["PAGEDOWN"] = 11, ["DELETE"] = 178, + ["LEFT"] = 174, ["RIGHT"] = 175, ["TOP"] = 27, ["DOWN"] = 173, + ["NENTER"] = 201, ["N4"] = 108, ["N5"] = 60, ["N6"] = 107, ["N+"] = 96, ["N-"] = 97, ["N7"] = 117, ["N8"] = 61, ["N9"] = 118 } local GUI = {} @@ -21,368 +21,368 @@ local Pickups = {} RegisterNetEvent('esx:playerLoaded') AddEventHandler('esx:playerLoaded', function(xPlayer) - ESX.PlayerLoaded = true - ESX.PlayerData = xPlayer + ESX.PlayerLoaded = true + ESX.PlayerData = xPlayer - for i=1, #xPlayer.accounts, 1 do + for i=1, #xPlayer.accounts, 1 do - local accountTpl = '
 {{money}}
' + local accountTpl = '
 {{money}}
' - ESX.UI.HUD.RegisterElement('account_' .. xPlayer.accounts[i].name, i-1, 0, accountTpl, { - money = 0 - }) + ESX.UI.HUD.RegisterElement('account_' .. xPlayer.accounts[i].name, i-1, 0, accountTpl, { + money = 0 + }) - ESX.UI.HUD.UpdateElement('account_' .. xPlayer.accounts[i].name, { - money = xPlayer.accounts[i].money - }) + ESX.UI.HUD.UpdateElement('account_' .. xPlayer.accounts[i].name, { + money = xPlayer.accounts[i].money + }) - end + end - local jobTpl = '
{{job_label}} - {{grade_label}}
' + local jobTpl = '
{{job_label}} - {{grade_label}}
' - if xPlayer.job.grade_label == '' then - jobTpl = '
{{job_label}}
' - end + if xPlayer.job.grade_label == '' then + jobTpl = '
{{job_label}}
' + end - ESX.UI.HUD.RegisterElement('job', #xPlayer.accounts, 0, jobTpl, { - job_label = '', - grade_label = '' - }) + ESX.UI.HUD.RegisterElement('job', #xPlayer.accounts, 0, jobTpl, { + job_label = '', + grade_label = '' + }) - ESX.UI.HUD.UpdateElement('job', { - job_label = xPlayer.job.label, - grade_label = xPlayer.job.grade_label - }) + ESX.UI.HUD.UpdateElement('job', { + job_label = xPlayer.job.label, + grade_label = xPlayer.job.grade_label + }) end) AddEventHandler('playerSpawned', function() - Citizen.CreateThread(function() + Citizen.CreateThread(function() - while not ESX.PlayerLoaded do - Citizen.Wait(0) - end + while not ESX.PlayerLoaded do + Citizen.Wait(0) + end - local playerPed = GetPlayerPed(-1) + local playerPed = GetPlayerPed(-1) - -- Restore position - if ESX.PlayerData.lastPosition ~= nil then - SetEntityCoords(playerPed, ESX.PlayerData.lastPosition.x, ESX.PlayerData.lastPosition.y, ESX.PlayerData.lastPosition.z) - end + -- Restore position + if ESX.PlayerData.lastPosition ~= nil then + SetEntityCoords(playerPed, ESX.PlayerData.lastPosition.x, ESX.PlayerData.lastPosition.y, ESX.PlayerData.lastPosition.z) + end - -- Restore loadout - for i=1, #ESX.PlayerData.loadout, 1 do - local weaponHash = GetHashKey(ESX.PlayerData.loadout[i].name) - GiveWeaponToPed(playerPed, weaponHash, ESX.PlayerData.loadout[i].ammo, false, false) - end + -- Restore loadout + for i=1, #ESX.PlayerData.loadout, 1 do + local weaponHash = GetHashKey(ESX.PlayerData.loadout[i].name) + GiveWeaponToPed(playerPed, weaponHash, ESX.PlayerData.loadout[i].ammo, false, false) + end - LoadoutLoaded = true - PlayerSpawned = true + LoadoutLoaded = true + PlayerSpawned = true - end) + end) end) AddEventHandler('skinchanger:loadDefaultModel', function() - LoadoutLoaded = false + LoadoutLoaded = false end) AddEventHandler('skinchanger:modelLoaded', function() - while not ESX.PlayerLoaded do - Citizen.Wait(0) - end - - TriggerEvent('esx:restoreLoadout') + while not ESX.PlayerLoaded do + Citizen.Wait(0) + end + + TriggerEvent('esx:restoreLoadout') end) AddEventHandler('esx:restoreLoadout', function () - local playerPed = GetPlayerPed(-1) + local playerPed = GetPlayerPed(-1) - for i=1, #ESX.PlayerData.loadout, 1 do - local weaponHash = GetHashKey(ESX.PlayerData.loadout[i].name) - GiveWeaponToPed(playerPed, weaponHash, ESX.PlayerData.loadout[i].ammo, false, false) - end + for i=1, #ESX.PlayerData.loadout, 1 do + local weaponHash = GetHashKey(ESX.PlayerData.loadout[i].name) + GiveWeaponToPed(playerPed, weaponHash, ESX.PlayerData.loadout[i].ammo, false, false) + end - LoadoutLoaded = true + LoadoutLoaded = true end) RegisterNetEvent('esx:setAccountMoney') AddEventHandler('esx:setAccountMoney', function(account) - for i=1, #ESX.PlayerData.accounts, 1 do - if ESX.PlayerData.accounts[i].name == account.name then - ESX.PlayerData.accounts[i] = account - end - end + for i=1, #ESX.PlayerData.accounts, 1 do + if ESX.PlayerData.accounts[i].name == account.name then + ESX.PlayerData.accounts[i] = account + end + end - ESX.UI.HUD.UpdateElement('account_' .. account.name, { - money = account.money - }) + ESX.UI.HUD.UpdateElement('account_' .. account.name, { + money = account.money + }) end) RegisterNetEvent('es:activateMoney') AddEventHandler('es:activateMoney', function(money) - ESX.PlayerData.money = money + ESX.PlayerData.money = money end) RegisterNetEvent('esx:addInventoryItem') AddEventHandler('esx:addInventoryItem', function(item, count) - - for i=1, #ESX.PlayerData.inventory, 1 do - if ESX.PlayerData.inventory[i].name == item.name then - ESX.PlayerData.inventory[i] = item - end - end - ESX.UI.ShowInventoryItemNotification(true, item, count) + for i=1, #ESX.PlayerData.inventory, 1 do + if ESX.PlayerData.inventory[i].name == item.name then + ESX.PlayerData.inventory[i] = item + end + end - if ESX.UI.Menu.IsOpen('default', 'es_extended', 'inventory') then - ESX.ShowInventory() - end + ESX.UI.ShowInventoryItemNotification(true, item, count) + + if ESX.UI.Menu.IsOpen('default', 'es_extended', 'inventory') then + ESX.ShowInventory() + end end) RegisterNetEvent('esx:removeInventoryItem') AddEventHandler('esx:removeInventoryItem', function(item, count) - for i=1, #ESX.PlayerData.inventory, 1 do - if ESX.PlayerData.inventory[i].name == item.name then - ESX.PlayerData.inventory[i] = item - end - end + for i=1, #ESX.PlayerData.inventory, 1 do + if ESX.PlayerData.inventory[i].name == item.name then + ESX.PlayerData.inventory[i] = item + end + end - ESX.UI.ShowInventoryItemNotification(false, item, count) + ESX.UI.ShowInventoryItemNotification(false, item, count) + + if ESX.UI.Menu.IsOpen('default', 'es_extended', 'inventory') then + ESX.ShowInventory() + end - if ESX.UI.Menu.IsOpen('default', 'es_extended', 'inventory') then - ESX.ShowInventory() - end - end) RegisterNetEvent('esx:setJob') AddEventHandler('esx:setJob', function(job) - ESX.PlayerData.job = job + ESX.PlayerData.job = job end) RegisterNetEvent('esx:addWeapon') AddEventHandler('esx:addWeapon', function(weaponName, ammo) - local playerPed = GetPlayerPed(-1) - local weaponHash = GetHashKey(weaponName) - - GiveWeaponToPed(playerPed, weaponHash, ammo, false, false) + local playerPed = GetPlayerPed(-1) + local weaponHash = GetHashKey(weaponName) + + GiveWeaponToPed(playerPed, weaponHash, ammo, false, false) end) RegisterNetEvent('esx:removeWeapon') AddEventHandler('esx:removeWeapon', function(weaponName) - local playerPed = GetPlayerPed(-1) - local weaponHash = GetHashKey(weaponName) - - RemoveWeaponFromPed(playerPed, weaponHash) + local playerPed = GetPlayerPed(-1) + local weaponHash = GetHashKey(weaponName) + + RemoveWeaponFromPed(playerPed, weaponHash) end) -- Commands RegisterNetEvent('esx:teleport') AddEventHandler('esx:teleport', function(pos) - pos.x = pos.x + 0.0 - pos.y = pos.y + 0.0 - pos.z = pos.z + 0.0 + pos.x = pos.x + 0.0 + pos.y = pos.y + 0.0 + pos.z = pos.z + 0.0 - RequestCollisionAtCoord(pos.x, pos.y, pos.z) - - while not HasCollisionLoadedAroundEntity(GetPlayerPed(-1)) do - RequestCollisionAtCoord(pos.x, pos.y, pos.z) - Citizen.Wait(0) - end + RequestCollisionAtCoord(pos.x, pos.y, pos.z) - SetEntityCoords(GetPlayerPed(-1), pos.x, pos.y, pos.z) + while not HasCollisionLoadedAroundEntity(GetPlayerPed(-1)) do + RequestCollisionAtCoord(pos.x, pos.y, pos.z) + Citizen.Wait(0) + end + + SetEntityCoords(GetPlayerPed(-1), pos.x, pos.y, pos.z) end) RegisterNetEvent('esx:setJob') AddEventHandler('esx:setJob', function(job) - ESX.UI.HUD.UpdateElement('job', { - job_label = job.label, - grade_label = job.grade_label - }) + ESX.UI.HUD.UpdateElement('job', { + job_label = job.label, + grade_label = job.grade_label + }) end) RegisterNetEvent('esx:loadIPL') AddEventHandler('esx:loadIPL', function(name) - Citizen.CreateThread(function() - LoadMpDlcMaps() - EnableMpDlcMaps(true) - RequestIpl(name) - end) + Citizen.CreateThread(function() + LoadMpDlcMaps() + EnableMpDlcMaps(true) + RequestIpl(name) + end) end) RegisterNetEvent('esx:unloadIPL') AddEventHandler('esx:unloadIPL', function(name) - Citizen.CreateThread(function() - RemoveIpl(name) - end) + Citizen.CreateThread(function() + RemoveIpl(name) + end) end) RegisterNetEvent('esx:playAnim') AddEventHandler('esx:playAnim', function(dict, anim) - Citizen.CreateThread(function() + Citizen.CreateThread(function() - local pid = PlayerPedId() - - RequestAnimDict(dict) - - while not HasAnimDictLoaded(dict) do - Wait(0) - end + local pid = PlayerPedId() - TaskPlayAnim(pid, dict, anim, 1.0, -1.0, 20000, 0, 1, true, true, true) - - end) + RequestAnimDict(dict) + + while not HasAnimDictLoaded(dict) do + Wait(0) + end + + TaskPlayAnim(pid, dict, anim, 1.0, -1.0, 20000, 0, 1, true, true, true) + + end) end) RegisterNetEvent('esx:playEmote') AddEventHandler('esx:playEmote', function(emote) - Citizen.CreateThread(function() - - local playerPed = GetPlayerPed(-1) + Citizen.CreateThread(function() - TaskStartScenarioInPlace(playerPed, emote, 0, false); - Wait(20000) - ClearPedTasks(playerPed) + local playerPed = GetPlayerPed(-1) - end) + TaskStartScenarioInPlace(playerPed, emote, 0, false); + Wait(20000) + ClearPedTasks(playerPed) + + end) end) RegisterNetEvent('esx:spawnVehicle') AddEventHandler('esx:spawnVehicle', function(model) - local playerPed = GetPlayerPed(-1) - local coords = GetEntityCoords(playerPed) + local playerPed = GetPlayerPed(-1) + local coords = GetEntityCoords(playerPed) - ESX.Game.SpawnVehicle(model, coords, 90.0, function(vehicle) - TaskWarpPedIntoVehicle(playerPed, vehicle, -1) - end) + ESX.Game.SpawnVehicle(model, coords, 90.0, function(vehicle) + TaskWarpPedIntoVehicle(playerPed, vehicle, -1) + end) end) RegisterNetEvent('esx:spawnObject') AddEventHandler('esx:spawnObject', function(model) - local playerPed = GetPlayerPed(-1) - local coords = GetEntityCoords(playerPed) - local forward = GetEntityForwardVector(playerPed) - local x, y, z = table.unpack(coords + forward * 1.0) + local playerPed = GetPlayerPed(-1) + local coords = GetEntityCoords(playerPed) + local forward = GetEntityForwardVector(playerPed) + local x, y, z = table.unpack(coords + forward * 1.0) - ESX.Game.SpawnObject(model, { - x = x, - y = y, - z = z - }, function(obj) - SetEntityHeading(obj, GetEntityHeading(playerPed)) - PlaceObjectOnGroundProperly(obj) - end) + ESX.Game.SpawnObject(model, { + x = x, + y = y, + z = z + }, function(obj) + SetEntityHeading(obj, GetEntityHeading(playerPed)) + PlaceObjectOnGroundProperly(obj) + end) end) RegisterNetEvent('esx:pickup') AddEventHandler('esx:pickup', function(id, label, player) - local ped = GetPlayerPed(GetPlayerFromServerId(player)) - local coords = GetEntityCoords(ped) - local forward = GetEntityForwardVector(ped) - local x, y, z = table.unpack(coords + forward * -2.0) + local ped = GetPlayerPed(GetPlayerFromServerId(player)) + local coords = GetEntityCoords(ped) + local forward = GetEntityForwardVector(ped) + local x, y, z = table.unpack(coords + forward * -2.0) - ESX.Game.SpawnLocalObject('prop_money_bag_01', { - x = x, - y = y, - z = z - 2.0, - }, function(obj) - - SetEntityAsMissionEntity(obj, true, false) + ESX.Game.SpawnLocalObject('prop_money_bag_01', { + x = x, + y = y, + z = z - 2.0, + }, function(obj) - PlaceObjectOnGroundProperly(obj) - - Pickups[id] = { - id = id, - obj = obj, - label = label, - inRange = false, - coords = { - x = x, - y = y, - z = z - }, - } + SetEntityAsMissionEntity(obj, true, false) - end) + PlaceObjectOnGroundProperly(obj) + + Pickups[id] = { + id = id, + obj = obj, + label = label, + inRange = false, + coords = { + x = x, + y = y, + z = z + }, + } + + end) end) RegisterNetEvent('esx:removePickup') AddEventHandler('esx:removePickup', function(id) - ESX.Game.DeleteObject(Pickups[id].obj) - Pickups[id] = nil + ESX.Game.DeleteObject(Pickups[id].obj) + Pickups[id] = nil end) RegisterNetEvent('esx:pickupWeapon') AddEventHandler('esx:pickupWeapon', function(weaponPickup, weaponName) - - local ped = GetPlayerPed(-1) - local playerPedPos = GetEntityCoords(ped, true) - - CreateAmbientPickup(GetHashKey(weaponPickup), playerPedPos.x + 2.0, playerPedPos.y, playerPedPos.z + 0.5, 0, 1000, 1, false, true) + + local ped = GetPlayerPed(-1) + local playerPedPos = GetEntityCoords(ped, true) + + CreateAmbientPickup(GetHashKey(weaponPickup), playerPedPos.x + 2.0, playerPedPos.y, playerPedPos.z + 0.5, 0, 1000, 1, false, true) end) RegisterNetEvent('esx:spawnPed') AddEventHandler('esx:spawnPed', function(model) - model = (tonumber(model) ~= nil and tonumber(model) or GetHashKey(model)) - local playerPed = GetPlayerPed(-1) - local coords = GetEntityCoords(playerPed) - local forward = GetEntityForwardVector(playerPed) - local x, y, z = table.unpack(coords + forward * 1.0) + model = (tonumber(model) ~= nil and tonumber(model) or GetHashKey(model)) + local playerPed = GetPlayerPed(-1) + local coords = GetEntityCoords(playerPed) + local forward = GetEntityForwardVector(playerPed) + local x, y, z = table.unpack(coords + forward * 1.0) - Citizen.CreateThread(function() + Citizen.CreateThread(function() - RequestModel(model) + RequestModel(model) - while not HasModelLoaded(model) do - Citizen.Wait(0) - end + while not HasModelLoaded(model) do + Citizen.Wait(0) + end - CreatePed(5, model, x, y, z, 0.0, true, false) + CreatePed(5, model, x, y, z, 0.0, true, false) - end) + end) end) RegisterNetEvent('esx:deleteVehicle') AddEventHandler('esx:deleteVehicle', function() - local playerPed = GetPlayerPed(-1) - local coords = GetEntityCoords(playerPed) + local playerPed = GetPlayerPed(-1) + local coords = GetEntityCoords(playerPed) - if IsPedInAnyVehicle(playerPed, false) then - - local vehicle = GetVehiclePedIsIn(playerPed, false) - ESX.Game.DeleteVehicle(vehicle) - - elseif IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then - - local vehicle = GetClosestVehicle(coords.x, coords.y, coords.z, 5.0, 0, 71) - ESX.Game.DeleteVehicle(vehicle) - - end + if IsPedInAnyVehicle(playerPed, false) then + + local vehicle = GetVehiclePedIsIn(playerPed, false) + ESX.Game.DeleteVehicle(vehicle) + + elseif IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then + + local vehicle = GetClosestVehicle(coords.x, coords.y, coords.z, 5.0, 0, 71) + ESX.Game.DeleteVehicle(vehicle) + + end end) @@ -394,11 +394,11 @@ Citizen.CreateThread(function() if IsPauseMenuActive() and not IsPaused then IsPaused = true TriggerEvent('es:setMoneyDisplay', 0.0) - ESX.UI.HUD.SetDisplay(0.0) + ESX.UI.HUD.SetDisplay(0.0) elseif not IsPauseMenuActive() and IsPaused then IsPaused = false TriggerEvent('es:setMoneyDisplay', 1.0) - ESX.UI.HUD.SetDisplay(1.0) + ESX.UI.HUD.SetDisplay(1.0) end end end) @@ -406,67 +406,67 @@ end) -- Save loadout Citizen.CreateThread(function() - while true do + while true do - Wait(0) + Wait(0) - local playerPed = GetPlayerPed(-1) - local loadout = {} - local loadoutChanged = false - - if IsPedDeadOrDying(playerPed) then - LoadoutLoaded = false - end + local playerPed = GetPlayerPed(-1) + local loadout = {} + local loadoutChanged = false - for i=1, #Config.Weapons, 1 do + if IsPedDeadOrDying(playerPed) then + LoadoutLoaded = false + end - local weaponHash = GetHashKey(Config.Weapons[i].name) + for i=1, #Config.Weapons, 1 do - if HasPedGotWeapon(playerPed, weaponHash, false) and Config.Weapons[i].name ~= 'WEAPON_UNARMED' then + local weaponHash = GetHashKey(Config.Weapons[i].name) - local ammo = GetAmmoInPedWeapon(playerPed, weaponHash) + if HasPedGotWeapon(playerPed, weaponHash, false) and Config.Weapons[i].name ~= 'WEAPON_UNARMED' then - if LastLoadout[Config.Weapons[i].name] == nil or LastLoadout[Config.Weapons[i].name] ~= ammo then - loadoutChanged = true - end + local ammo = GetAmmoInPedWeapon(playerPed, weaponHash) - LastLoadout[Config.Weapons[i].name] = ammo + if LastLoadout[Config.Weapons[i].name] == nil or LastLoadout[Config.Weapons[i].name] ~= ammo then + loadoutChanged = true + end - table.insert(loadout, { - name = Config.Weapons[i].name, - ammo = ammo, - label = Config.Weapons[i].label - }) + LastLoadout[Config.Weapons[i].name] = ammo - else + table.insert(loadout, { + name = Config.Weapons[i].name, + ammo = ammo, + label = Config.Weapons[i].label + }) - if LastLoadout[Config.Weapons[i].name] ~= nil then - loadoutChanged = true - end + else - LastLoadout[Config.Weapons[i].name] = nil + if LastLoadout[Config.Weapons[i].name] ~= nil then + loadoutChanged = true + end - end + LastLoadout[Config.Weapons[i].name] = nil - end + end - if loadoutChanged and LoadoutLoaded then - ESX.PlayerData.loadout = loadout - TriggerServerEvent('esx:updateLoadout', loadout) - end + end - end + if loadoutChanged and LoadoutLoaded then + ESX.PlayerData.loadout = loadout + TriggerServerEvent('esx:updateLoadout', loadout) + end + + end end) -- Menu interactions Citizen.CreateThread(function() - while true do + while true do - Wait(0) + Wait(0) - if IsControlPressed(0, Keys["F2"]) and not ESX.UI.Menu.IsOpen('default', 'es_extended', 'inventory') and (GetGameTimer() - GUI.Time) > 150 then - ESX.ShowInventory() - GUI.Time = GetGameTimer() + if IsControlPressed(0, Keys["F2"]) and not ESX.UI.Menu.IsOpen('default', 'es_extended', 'inventory') and (GetGameTimer() - GUI.Time) > 150 then + ESX.ShowInventory() + GUI.Time = GetGameTimer() end end @@ -475,31 +475,31 @@ end) -- Dot above head if Config.ShowDotAbovePlayer then - Citizen.CreateThread(function() - while true do + Citizen.CreateThread(function() + while true do - Citizen.Wait(0) + Citizen.Wait(0) - local players = ESX.Game.GetPlayers() + local players = ESX.Game.GetPlayers() - for i = 1, #players, 1 do - if players[i] ~= PlayerId() then - local ped = GetPlayerPed(players[i]) - local headId = Citizen.InvokeNative(0xBFEFE3321A3F5015, ped, ('·'), false, false, '', false) - end - end + for i = 1, #players, 1 do + if players[i] ~= PlayerId() then + local ped = GetPlayerPed(players[i]) + local headId = Citizen.InvokeNative(0xBFEFE3321A3F5015, ped, ('·'), false, false, '', false) + end + end - end - end) + end + end) end -- Disable wanted level if Config.DisableWantedLevel then - Citizen.CreateThread(function() + Citizen.CreateThread(function() while true do - + Citizen.Wait(0) local playerId = PlayerId() @@ -510,76 +510,76 @@ if Config.DisableWantedLevel then end end - end) + end) end -- Pickups Citizen.CreateThread(function() - while true do + while true do - Citizen.Wait(0) + Citizen.Wait(0) - local playerPed = GetPlayerPed(-1) - local coords = GetEntityCoords(playerPed) + local playerPed = GetPlayerPed(-1) + local coords = GetEntityCoords(playerPed) - for k,v in pairs(Pickups) do + for k,v in pairs(Pickups) do - local distance = GetDistanceBetweenCoords(coords.x, coords.y, coords.z, v.coords.x, v.coords.y, v.coords.z, true) + local distance = GetDistanceBetweenCoords(coords.x, coords.y, coords.z, v.coords.x, v.coords.y, v.coords.z, true) - if distance <= 5.0 then - - ESX.Game.Utils.DrawText3D({ - x = v.coords.x, - y = v.coords.y, - z = v.coords.z + 0.25 - }, v.label) + if distance <= 5.0 then - end + ESX.Game.Utils.DrawText3D({ + x = v.coords.x, + y = v.coords.y, + z = v.coords.z + 0.25 + }, v.label) - if distance <= 1.0 and not v.inRange then - TriggerServerEvent('esx:onPickup', v.id) - v.inRange = true - end + end - end + if distance <= 1.0 and not v.inRange then + TriggerServerEvent('esx:onPickup', v.id) + v.inRange = true + end - end + end + + end end) -- Last position Citizen.CreateThread(function() - - while true do - Citizen.Wait(1000) + while true do - if ESX ~= nil and ESX.PlayerLoaded and PlayerSpawned then + Citizen.Wait(1000) - local playerPed = GetPlayerPed(-1) - local coords = GetEntityCoords(playerPed) + if ESX ~= nil and ESX.PlayerLoaded and PlayerSpawned then - if not IsEntityDead(playerPed) then - ESX.PlayerData.lastPosition = {x = coords.x, y = coords.y, z = coords.z} - end + local playerPed = GetPlayerPed(-1) + local coords = GetEntityCoords(playerPed) - end + if not IsEntityDead(playerPed) then + ESX.PlayerData.lastPosition = {x = coords.x, y = coords.y, z = coords.z} + end - end + end + + end end) Citizen.CreateThread(function() - while true do + while true do - Citizen.Wait(0) + Citizen.Wait(0) - local playerPed = GetPlayerPed(-1) + local playerPed = GetPlayerPed(-1) - if IsEntityDead(playerPed) and PlayerSpawned then - PlayerSpawned = false - end - end + if IsEntityDead(playerPed) and PlayerSpawned then + PlayerSpawned = false + end + end end) diff --git a/resources/[essential]/es_extended/config.lua b/resources/[essential]/es_extended/config.lua index b6714cc6..215a67fb 100644 --- a/resources/[essential]/es_extended/config.lua +++ b/resources/[essential]/es_extended/config.lua @@ -1,8 +1,8 @@ Config = {} Config.MaxPlayers = 32 -Config.Accounts = {'bank', 'black_money'} -Config.AccountLabels = {bank = 'Banque', black_money = 'Argent Sale'} -- French ---Config.AccountLabels = {bank = 'Bank', black_money = 'Dirty Money'} -- English +Config.Accounts = { 'bank', 'black_money' } +Config.AccountLabels = { bank = 'Banque', black_money = 'Argent Sale' } -- French +-- Config.AccountLabels = { bank = 'Bank', black_money = 'Dirty Money' } -- English Config.PaycheckInterval = 7 * 60000 Config.ShowDotAbovePlayer = false Config.DisableWantedLevel = true diff --git a/resources/[essential]/es_extended/config.weapons.lua b/resources/[essential]/es_extended/config.weapons.lua index 3ce8b4c5..ec1327ce 100644 --- a/resources/[essential]/es_extended/config.weapons.lua +++ b/resources/[essential]/es_extended/config.weapons.lua @@ -1,81 +1,80 @@ Config.Weapons = { - - {name = 'WEAPON_KNIFE', label = _U('weapon_knife')}, - {name = 'WEAPON_NIGHTSTICK', label = _U('weapon_nightstick')}, - {name = 'WEAPON_HAMMER', label = _U('weapon_hammer')}, - {name = 'WEAPON_BAT', label = _U('weapon_bat')}, - {name = 'WEAPON_GOLFCLUB', label = _U('weapon_golfclub')}, - {name = 'WEAPON_CROWBAR', label = _U('weapon_crowbar')}, - {name = 'WEAPON_PISTOL', label = _U('weapon_pistol')}, - {name = 'WEAPON_COMBATPISTOL', label = _U('weapon_combatpistol')}, - {name = 'WEAPON_APPISTOL', label = _U('weapon_appistol')}, - {name = 'WEAPON_PISTOL50', label = _U('weapon_pistol50')}, - {name = 'WEAPON_MICROSMG', label = _U('weapon_microsmg')}, - {name = 'WEAPON_SMG', label = _U('weapon_smg')}, - {name = 'WEAPON_ASSAULTSMG', label = _U('weapon_assaultsmg')}, - {name = 'WEAPON_ASSAULTRIFLE', label = _U('weapon_assaultrifle')}, - {name = 'WEAPON_CARBINERIFLE', label = _U('weapon_carbinerifle')}, - {name = 'WEAPON_ADVANCEDRIFLE', label = _U('weapon_advancedrifle')}, - {name = 'WEAPON_MG', label = _U('weapon_mg')}, - {name = 'WEAPON_COMBATMG', label = _U('weapon_combatmg')}, - {name = 'WEAPON_PUMPSHOTGUN', label = _U('weapon_pumpshotgun')}, - {name = 'WEAPON_SAWNOFFSHOTGUN', label = _U('weapon_sawnoffshotgun')}, - {name = 'WEAPON_ASSAULTSHOTGUN', label = _U('weapon_assaultshotgun')}, - {name = 'WEAPON_BULLPUPSHOTGUN', label = _U('weapon_bullpupshotgun')}, - {name = 'WEAPON_STUNGUN', label = _U('weapon_stungun')}, - {name = 'WEAPON_SNIPERRIFLE', label = _U('weapon_sniperrifle')}, - {name = 'WEAPON_HEAVYSNIPER', label = _U('weapon_heavysniper')}, - {name = 'WEAPON_REMOTESNIPER', label = _U('weapon_remotesniper')}, - {name = 'WEAPON_GRENADELAUNCHER', label = _U('weapon_grenadelauncher')}, - {name = 'WEAPON_RPG', label = _U('weapon_rpg')}, - {name = 'WEAPON_STINGER', label = _U('weapon_stinger')}, - {name = 'WEAPON_MINIGUN', label = _U('weapon_minigun')}, - {name = 'WEAPON_GRENADE', label = _U('weapon_grenade')}, - {name = 'WEAPON_STICKYBOMB', label = _U('weapon_stickybomb')}, - {name = 'WEAPON_SMOKEGRENADE', label = _U('weapon_smokegrenade')}, - {name = 'WEAPON_BZGAS', label = _U('weapon_bzgas')}, - {name = 'WEAPON_MOLOTOV', label = _U('weapon_molotov')}, - {name = 'WEAPON_FIREEXTINGUISHER', label = _U('weapon_fireextinguisher')}, - {name = 'WEAPON_PETROLCAN', label = _U('weapon_petrolcan')}, - {name = 'WEAPON_DIGISCANNER', label = _U('weapon_digiscanner')}, - {name = 'WEAPON_BALL', label = _U('weapon_ball')}, - {name = 'WEAPON_SNSPISTOL', label = _U('weapon_snspistol')}, - {name = 'WEAPON_BOTTLE', label = _U('weapon_bottle')}, - {name = 'WEAPON_GUSENBERG', label = _U('weapon_gusenberg')}, - {name = 'WEAPON_SPECIALCARBINE', label = _U('weapon_specialcarbine')}, - {name = 'WEAPON_HEAVYPISTOL', label = _U('weapon_heavypistol')}, - {name = 'WEAPON_BULLPUPRIFLE', label = _U('weapon_bullpuprifle')}, - {name = 'WEAPON_DAGGER', label = _U('weapon_dagger')}, - {name = 'WEAPON_VINTAGEPISTOL', label = _U('weapon_vintagepistol')}, - {name = 'WEAPON_FIREWORK', label = _U('weapon_firework')}, - {name = 'WEAPON_MUSKET', label = _U('weapon_musket')}, - {name = 'WEAPON_HEAVYSHOTGUN', label = _U('weapon_heavyshotgun')}, - {name = 'WEAPON_MARKSMANRIFLE', label = _U('weapon_marksmanrifle')}, - {name = 'WEAPON_HOMINGLAUNCHER', label = _U('weapon_hominglauncher')}, - {name = 'WEAPON_PROXMINE', label = _U('weapon_proxmine')}, - {name = 'WEAPON_SNOWBALL', label = _U('weapon_snowball')}, - {name = 'WEAPON_FLAREGUN', label = _U('weapon_flaregun')}, - {name = 'WEAPON_GARBAGEBAG', label = _U('weapon_garbagebag')}, - {name = 'WEAPON_HANDCUFFS', label = _U('weapon_handcuffs')}, - {name = 'WEAPON_COMBATPDW', label = _U('weapon_combatpdw')}, - {name = 'WEAPON_MARKSMANPISTOL', label = _U('weapon_marksmanpistol')}, - {name = 'WEAPON_KNUCKLE', label = _U('weapon_knuckle')}, - {name = 'WEAPON_HATCHET', label = _U('weapon_hatchet')}, - {name = 'WEAPON_RAILGUN', label = _U('weapon_railgun')}, - {name = 'WEAPON_MACHETE', label = _U('weapon_machete')}, - {name = 'WEAPON_MACHINEPISTOL', label = _U('weapon_machinepistol')}, - {name = 'WEAPON_SWITCHBLADE', label = _U('weapon_switchblade')}, - {name = 'WEAPON_REVOLVER', label = _U('weapon_revolver')}, - {name = 'WEAPON_DBSHOTGUN', label = _U('weapon_dbshotgun')}, - {name = 'WEAPON_COMPACTRIFLE', label = _U('weapon_compactrifle')}, - {name = 'WEAPON_AUTOSHOTGUN', label = _U('weapon_autoshotgun')}, - {name = 'WEAPON_BATTLEAXE', label = _U('weapon_battleaxe')}, - {name = 'WEAPON_COMPACTLAUNCHER', label = _U('weapon_compactlauncher')}, - {name = 'WEAPON_MINISMG', label = _U('weapon_minismg')}, - {name = 'WEAPON_PIPEBOMB', label = _U('weapon_pipebomb')}, - {name = 'WEAPON_POOLCUE', label = _U('weapon_poolcue')}, - {name = 'WEAPON_WRENCH', label = _U('weapon_wrench')}, - {name = 'WEAPON_FLASHLIGHT', label = _U('weapon_flashlight')}, - {name = 'GADGET_NIGHTVISION', label = _U('gadget_nightvision')}, - {name = 'GADGET_PARACHUTE', label = _U('gadget_parachute')}, -} \ No newline at end of file + { name = 'WEAPON_KNIFE', label = _U('weapon_knife') }, + { name = 'WEAPON_NIGHTSTICK', label = _U('weapon_nightstick') }, + { name = 'WEAPON_HAMMER', label = _U('weapon_hammer') }, + { name = 'WEAPON_BAT', label = _U('weapon_bat') }, + { name = 'WEAPON_GOLFCLUB', label = _U('weapon_golfclub') }, + { name = 'WEAPON_CROWBAR', label = _U('weapon_crowbar') }, + { name = 'WEAPON_PISTOL', label = _U('weapon_pistol') }, + { name = 'WEAPON_COMBATPISTOL', label = _U('weapon_combatpistol') }, + { name = 'WEAPON_APPISTOL', label = _U('weapon_appistol') }, + { name = 'WEAPON_PISTOL50', label = _U('weapon_pistol50') }, + { name = 'WEAPON_MICROSMG', label = _U('weapon_microsmg') }, + { name = 'WEAPON_SMG', label = _U('weapon_smg') }, + { name = 'WEAPON_ASSAULTSMG', label = _U('weapon_assaultsmg') }, + { name = 'WEAPON_ASSAULTRIFLE', label = _U('weapon_assaultrifle') }, + { name = 'WEAPON_CARBINERIFLE', label = _U('weapon_carbinerifle') }, + { name = 'WEAPON_ADVANCEDRIFLE', label = _U('weapon_advancedrifle') }, + { name = 'WEAPON_MG', label = _U('weapon_mg') }, + { name = 'WEAPON_COMBATMG', label = _U('weapon_combatmg') }, + { name = 'WEAPON_PUMPSHOTGUN', label = _U('weapon_pumpshotgun') }, + { name = 'WEAPON_SAWNOFFSHOTGUN', label = _U('weapon_sawnoffshotgun') }, + { name = 'WEAPON_ASSAULTSHOTGUN', label = _U('weapon_assaultshotgun') }, + { name = 'WEAPON_BULLPUPSHOTGUN', label = _U('weapon_bullpupshotgun') }, + { name = 'WEAPON_STUNGUN', label = _U('weapon_stungun') }, + { name = 'WEAPON_SNIPERRIFLE', label = _U('weapon_sniperrifle') }, + { name = 'WEAPON_HEAVYSNIPER', label = _U('weapon_heavysniper') }, + { name = 'WEAPON_REMOTESNIPER', label = _U('weapon_remotesniper') }, + { name = 'WEAPON_GRENADELAUNCHER', label = _U('weapon_grenadelauncher') }, + { name = 'WEAPON_RPG', label = _U('weapon_rpg') }, + { name = 'WEAPON_STINGER', label = _U('weapon_stinger') }, + { name = 'WEAPON_MINIGUN', label = _U('weapon_minigun') }, + { name = 'WEAPON_GRENADE', label = _U('weapon_grenade') }, + { name = 'WEAPON_STICKYBOMB', label = _U('weapon_stickybomb') }, + { name = 'WEAPON_SMOKEGRENADE', label = _U('weapon_smokegrenade') }, + { name = 'WEAPON_BZGAS', label = _U('weapon_bzgas') }, + { name = 'WEAPON_MOLOTOV', label = _U('weapon_molotov') }, + { name = 'WEAPON_FIREEXTINGUISHER', label = _U('weapon_fireextinguisher') }, + { name = 'WEAPON_PETROLCAN', label = _U('weapon_petrolcan') }, + { name = 'WEAPON_DIGISCANNER', label = _U('weapon_digiscanner') }, + { name = 'WEAPON_BALL', label = _U('weapon_ball') }, + { name = 'WEAPON_SNSPISTOL', label = _U('weapon_snspistol') }, + { name = 'WEAPON_BOTTLE', label = _U('weapon_bottle') }, + { name = 'WEAPON_GUSENBERG', label = _U('weapon_gusenberg') }, + { name = 'WEAPON_SPECIALCARBINE', label = _U('weapon_specialcarbine') }, + { name = 'WEAPON_HEAVYPISTOL', label = _U('weapon_heavypistol') }, + { name = 'WEAPON_BULLPUPRIFLE', label = _U('weapon_bullpuprifle') }, + { name = 'WEAPON_DAGGER', label = _U('weapon_dagger') }, + { name = 'WEAPON_VINTAGEPISTOL', label = _U('weapon_vintagepistol') }, + { name = 'WEAPON_FIREWORK', label = _U('weapon_firework') }, + { name = 'WEAPON_MUSKET', label = _U('weapon_musket') }, + { name = 'WEAPON_HEAVYSHOTGUN', label = _U('weapon_heavyshotgun') }, + { name = 'WEAPON_MARKSMANRIFLE', label = _U('weapon_marksmanrifle') }, + { name = 'WEAPON_HOMINGLAUNCHER', label = _U('weapon_hominglauncher') }, + { name = 'WEAPON_PROXMINE', label = _U('weapon_proxmine') }, + { name = 'WEAPON_SNOWBALL', label = _U('weapon_snowball') }, + { name = 'WEAPON_FLAREGUN', label = _U('weapon_flaregun') }, + { name = 'WEAPON_GARBAGEBAG', label = _U('weapon_garbagebag') }, + { name = 'WEAPON_HANDCUFFS', label = _U('weapon_handcuffs') }, + { name = 'WEAPON_COMBATPDW', label = _U('weapon_combatpdw') }, + { name = 'WEAPON_MARKSMANPISTOL', label = _U('weapon_marksmanpistol') }, + { name = 'WEAPON_KNUCKLE', label = _U('weapon_knuckle') }, + { name = 'WEAPON_HATCHET', label = _U('weapon_hatchet') }, + { name = 'WEAPON_RAILGUN', label = _U('weapon_railgun') }, + { name = 'WEAPON_MACHETE', label = _U('weapon_machete') }, + { name = 'WEAPON_MACHINEPISTOL', label = _U('weapon_machinepistol') }, + { name = 'WEAPON_SWITCHBLADE', label = _U('weapon_switchblade') }, + { name = 'WEAPON_REVOLVER', label = _U('weapon_revolver') }, + { name = 'WEAPON_DBSHOTGUN', label = _U('weapon_dbshotgun') }, + { name = 'WEAPON_COMPACTRIFLE', label = _U('weapon_compactrifle') }, + { name = 'WEAPON_AUTOSHOTGUN', label = _U('weapon_autoshotgun') }, + { name = 'WEAPON_BATTLEAXE', label = _U('weapon_battleaxe') }, + { name = 'WEAPON_COMPACTLAUNCHER', label = _U('weapon_compactlauncher') }, + { name = 'WEAPON_MINISMG', label = _U('weapon_minismg') }, + { name = 'WEAPON_PIPEBOMB', label = _U('weapon_pipebomb') }, + { name = 'WEAPON_POOLCUE', label = _U('weapon_poolcue') }, + { name = 'WEAPON_WRENCH', label = _U('weapon_wrench') }, + { name = 'WEAPON_FLASHLIGHT', label = _U('weapon_flashlight') }, + { name = 'GADGET_NIGHTVISION', label = _U('gadget_nightvision') }, + { name = 'GADGET_PARACHUTE', label = _U('gadget_parachute') }, +} diff --git a/resources/[essential]/es_extended/locale.lua b/resources/[essential]/es_extended/locale.lua index 03e2271f..208cf827 100644 --- a/resources/[essential]/es_extended/locale.lua +++ b/resources/[essential]/es_extended/locale.lua @@ -1,18 +1,18 @@ Locales = {} -function _(str, ...) -- Translate string +function _(str, ...) -- Translate string - if Locales[Config.Locale] ~= nil then + if Locales[Config.Locale] ~= nil then - if Locales[Config.Locale][str] ~= nil then - return string.format(Locales[Config.Locale][str], ...) - else - return 'Translation [' .. Config.Locale .. '][' .. str .. '] does not exists' - end + if Locales[Config.Locale][str] ~= nil then + return string.format(Locales[Config.Locale][str], ...) + else + return 'Translation [' .. Config.Locale .. '][' .. str .. '] does not exists' + end - else - return 'Locale [' .. Config.Locale .. '] does not exists' - end + else + return 'Locale [' .. Config.Locale .. '] does not exists' + end end diff --git a/resources/[essential]/es_extended/locales/br.lua b/resources/[essential]/es_extended/locales/br.lua index cf47cb80..89379694 100644 --- a/resources/[essential]/es_extended/locales/br.lua +++ b/resources/[essential]/es_extended/locales/br.lua @@ -1,122 +1,122 @@ Locales['br'] = { - ['inventory'] = 'inventário', - ['use'] = 'usar', - ['give'] = 'dar', - ['remove'] = 'remover', - ['return'] = 'voltar', - ['amount'] = 'quantidade', - ['amount_invalid'] = 'quantidade inválida', - ['players_nearby'] = 'nenhum jogador nas proximidades', - ['ex_inv_lim'] = 'Esta ação não é possível, supera o limite do inventário para ~b~', - ['yougave'] = 'você deu', - ['youreceived'] = 'você recebeu', - ['to'] = '~s~ para ~b~', - ['by'] = '~s~ por ~b~', - ['imp_invalid_quantity'] = 'ação impossível, quantidade inválida', - ['imp_invalid_amount'] = 'ação impossível, valor inválido', - ['delete_five_min'] = '~r~deleta~s~ em 5 minutos', - ['threw'] = 'você ~r~jogou~s~', - ['rec_salary'] = 'você recebeu seu salário: ', - ['act_imp'] = 'ação impossível', - -- Commands - ['setjob'] = 'atribuir um emprego a um usuário', - ['id_param'] = 'o id do jogador', - ['setjob_param2'] = 'o trabalho que você deseja atribuir', - ['setjob_param3'] = 'o nível de trabalho', - ['load_ipl'] = 'carregando ipl', - ['unload_ipl'] = 'descarregando ipl', - ['play_anim'] = 'reproduzir animação', - ['play_emote'] = 'reproduzir emote', - ['spawn_car'] = 'fazer aparecer um carro', - ['spawn_car_param'] = 'nome do carro', - ['spawn_object'] = 'gerar um objeto', - ['givemoney'] = 'dar dinheiro', - ['money_amount'] = 'quantia do dinheiro', - ['invalid_account'] = 'conta inválida', - ['account'] = 'conta', - ['giveaccountmoney'] = 'dar dinheiro em conta', - ['invalid_item'] = 'item inválido', - ['item'] = 'item', - ['giveitem'] = 'dar item', - ['weapon'] = 'arma', - ['giveweapon'] = 'dar arma', - -- Weapons - ['weapon_knife'] = 'ffaca', - ['weapon_nightstick'] = 'cacetete', - ['weapon_hammer'] = 'martelo', - ['weapon_bat'] = 'bastão', - ['weapon_golfclub'] = 'golf club', - ['weapon_crowbar'] = 'pé de cabra', - ['weapon_pistol'] = 'pistola', - ['weapon_combatpistol'] = 'pistola de combate', - ['weapon_appistol'] = 'ap pistola', - ['weapon_pistol50'] = 'pistola .50', - ['weapon_microsmg'] = 'micro smg', - ['weapon_smg'] = 'smg', - ['weapon_assaultsmg'] = 'assault smg', - ['weapon_assaultrifle'] = 'assault rifle', - ['weapon_carbinerifle'] = 'carbine rifle', - ['weapon_advancedrifle'] = 'advanced rifle', - ['weapon_mg'] = 'mg', - ['weapon_combatmg'] = 'combat mg', - ['weapon_pumpshotgun'] = 'espingarda', - ['weapon_sawnoffshotgun'] = 'sawed off shotgun', - ['weapon_assaultshotgun'] = 'assault shotgun', - ['weapon_bullpupshotgun'] = 'bullpup shotgun', - ['weapon_stungun'] = 'arma de choque', - ['weapon_sniperrifle'] = 'sniper rifle', - ['weapon_heavysniper'] = 'heavy sniper', - ['weapon_remotesniper'] = 'remote sniper', - ['weapon_grenadelauncher'] = 'lançador de granada', - ['weapon_rpg'] = 'lançador de foguetes', - ['weapon_stinger'] = 'stinger', - ['weapon_minigun'] = 'minigun', - ['weapon_grenade'] = 'granada', - ['weapon_stickybomb'] = 'bomba pegajosa', - ['weapon_smokegrenade'] = 'granada de fumaça', - ['weapon_bzgas'] = 'bz gas', - ['weapon_molotov'] = 'coquetel molotov', - ['weapon_fireextinguisher'] = 'extintor', - ['weapon_petrolcan'] = 'galão de combustivel', - ['weapon_digiscanner'] = 'digiscanner', - ['weapon_ball'] = 'bola', - ['weapon_snspistol'] = 'sns pistol', - ['weapon_bottle'] = 'garrafa', - ['weapon_gusenberg'] = 'gusenberg sweeper', - ['weapon_specialcarbine'] = 'carabina especial', - ['weapon_heavypistol'] = 'heavy pistol', - ['weapon_bullpuprifle'] = 'bullpup rifle', - ['weapon_dagger'] = 'punhal', - ['weapon_vintagepistol'] = 'vintage pistol', - ['weapon_firework'] = 'fogos de artifício', - ['weapon_musket'] = 'mosquete', - ['weapon_heavyshotgun'] = 'heavy shotgun', - ['weapon_marksmanrifle'] = 'marksman rifle', - ['weapon_hominglauncher'] = 'homing launcher', - ['weapon_proxmine'] = 'mina de proximidade', - ['weapon_snowball'] = 'bola de neve', - ['weapon_flaregun'] = 'sinalizador', - ['weapon_garbagebag'] = 'saco de lixo', - ['weapon_handcuffs'] = 'algemas', - ['weapon_combatpdw'] = 'combat pdw', - ['weapon_marksmanpistol'] = 'marksman pistol', - ['weapon_knuckle'] = 'soco inglês', - ['weapon_hatchet'] = 'machado', - ['weapon_railgun'] = 'railgun', - ['weapon_machete'] = 'facão', - ['weapon_machinepistol'] = 'machine pistol', - ['weapon_switchblade'] = 'canivete', - ['weapon_revolver'] = 'heavy revolver', - ['weapon_dbshotgun'] = 'espingarda de cano duplo', - ['weapon_compactrifle'] = 'compact rifle', - ['weapon_autoshotgun'] = 'auto shotgun', - ['weapon_battleaxe'] = 'battle axe', - ['weapon_compactlauncher'] = 'compact launcher', - ['weapon_minismg'] = 'mini smg', - ['weapon_pipebomb'] = 'bomba caseira', - ['weapon_poolcue'] = 'taco de sinuca', - ['weapon_wrench'] = 'chave de cano', - ['weapon_flashlight'] = 'laterna', - ['gadget_nightvision'] = 'visão noturna', - ['gadget_parachute'] = 'paraquedas', -} \ No newline at end of file + ['inventory'] = 'inventário', + ['use'] = 'usar', + ['give'] = 'dar', + ['remove'] = 'remover', + ['return'] = 'voltar', + ['amount'] = 'quantidade', + ['amount_invalid'] = 'quantidade inválida', + ['players_nearby'] = 'nenhum jogador nas proximidades', + ['ex_inv_lim'] = 'Esta ação não é possível, supera o limite do inventário para ~b~', + ['yougave'] = 'você deu', + ['youreceived'] = 'você recebeu', + ['to'] = '~s~ para ~b~', + ['by'] = '~s~ por ~b~', + ['imp_invalid_quantity'] = 'ação impossível, quantidade inválida', + ['imp_invalid_amount'] = 'ação impossível, valor inválido', + ['delete_five_min'] = '~r~deleta~s~ em 5 minutos', + ['threw'] = 'você ~r~jogou~s~', + ['rec_salary'] = 'você recebeu seu salário: ', + ['act_imp'] = 'ação impossível', + -- Commands + ['setjob'] = 'atribuir um emprego a um usuário', + ['id_param'] = 'o id do jogador', + ['setjob_param2'] = 'o trabalho que você deseja atribuir', + ['setjob_param3'] = 'o nível de trabalho', + ['load_ipl'] = 'carregando ipl', + ['unload_ipl'] = 'descarregando ipl', + ['play_anim'] = 'reproduzir animação', + ['play_emote'] = 'reproduzir emote', + ['spawn_car'] = 'fazer aparecer um carro', + ['spawn_car_param'] = 'nome do carro', + ['spawn_object'] = 'gerar um objeto', + ['givemoney'] = 'dar dinheiro', + ['money_amount'] = 'quantia do dinheiro', + ['invalid_account'] = 'conta inválida', + ['account'] = 'conta', + ['giveaccountmoney'] = 'dar dinheiro em conta', + ['invalid_item'] = 'item inválido', + ['item'] = 'item', + ['giveitem'] = 'dar item', + ['weapon'] = 'arma', + ['giveweapon'] = 'dar arma', + -- Weapons + ['weapon_knife'] = 'ffaca', + ['weapon_nightstick'] = 'cacetete', + ['weapon_hammer'] = 'martelo', + ['weapon_bat'] = 'bastão', + ['weapon_golfclub'] = 'golf club', + ['weapon_crowbar'] = 'pé de cabra', + ['weapon_pistol'] = 'pistola', + ['weapon_combatpistol'] = 'pistola de combate', + ['weapon_appistol'] = 'ap pistola', + ['weapon_pistol50'] = 'pistola .50', + ['weapon_microsmg'] = 'micro smg', + ['weapon_smg'] = 'smg', + ['weapon_assaultsmg'] = 'assault smg', + ['weapon_assaultrifle'] = 'assault rifle', + ['weapon_carbinerifle'] = 'carbine rifle', + ['weapon_advancedrifle'] = 'advanced rifle', + ['weapon_mg'] = 'mg', + ['weapon_combatmg'] = 'combat mg', + ['weapon_pumpshotgun'] = 'espingarda', + ['weapon_sawnoffshotgun'] = 'sawed off shotgun', + ['weapon_assaultshotgun'] = 'assault shotgun', + ['weapon_bullpupshotgun'] = 'bullpup shotgun', + ['weapon_stungun'] = 'arma de choque', + ['weapon_sniperrifle'] = 'sniper rifle', + ['weapon_heavysniper'] = 'heavy sniper', + ['weapon_remotesniper'] = 'remote sniper', + ['weapon_grenadelauncher'] = 'lançador de granada', + ['weapon_rpg'] = 'lançador de foguetes', + ['weapon_stinger'] = 'stinger', + ['weapon_minigun'] = 'minigun', + ['weapon_grenade'] = 'granada', + ['weapon_stickybomb'] = 'bomba pegajosa', + ['weapon_smokegrenade'] = 'granada de fumaça', + ['weapon_bzgas'] = 'bz gas', + ['weapon_molotov'] = 'coquetel molotov', + ['weapon_fireextinguisher'] = 'extintor', + ['weapon_petrolcan'] = 'galão de combustivel', + ['weapon_digiscanner'] = 'digiscanner', + ['weapon_ball'] = 'bola', + ['weapon_snspistol'] = 'sns pistol', + ['weapon_bottle'] = 'garrafa', + ['weapon_gusenberg'] = 'gusenberg sweeper', + ['weapon_specialcarbine'] = 'carabina especial', + ['weapon_heavypistol'] = 'heavy pistol', + ['weapon_bullpuprifle'] = 'bullpup rifle', + ['weapon_dagger'] = 'punhal', + ['weapon_vintagepistol'] = 'vintage pistol', + ['weapon_firework'] = 'fogos de artifício', + ['weapon_musket'] = 'mosquete', + ['weapon_heavyshotgun'] = 'heavy shotgun', + ['weapon_marksmanrifle'] = 'marksman rifle', + ['weapon_hominglauncher'] = 'homing launcher', + ['weapon_proxmine'] = 'mina de proximidade', + ['weapon_snowball'] = 'bola de neve', + ['weapon_flaregun'] = 'sinalizador', + ['weapon_garbagebag'] = 'saco de lixo', + ['weapon_handcuffs'] = 'algemas', + ['weapon_combatpdw'] = 'combat pdw', + ['weapon_marksmanpistol'] = 'marksman pistol', + ['weapon_knuckle'] = 'soco inglês', + ['weapon_hatchet'] = 'machado', + ['weapon_railgun'] = 'railgun', + ['weapon_machete'] = 'facão', + ['weapon_machinepistol'] = 'machine pistol', + ['weapon_switchblade'] = 'canivete', + ['weapon_revolver'] = 'heavy revolver', + ['weapon_dbshotgun'] = 'espingarda de cano duplo', + ['weapon_compactrifle'] = 'compact rifle', + ['weapon_autoshotgun'] = 'auto shotgun', + ['weapon_battleaxe'] = 'battle axe', + ['weapon_compactlauncher'] = 'compact launcher', + ['weapon_minismg'] = 'mini smg', + ['weapon_pipebomb'] = 'bomba caseira', + ['weapon_poolcue'] = 'taco de sinuca', + ['weapon_wrench'] = 'chave de cano', + ['weapon_flashlight'] = 'laterna', + ['gadget_nightvision'] = 'visão noturna', + ['gadget_parachute'] = 'paraquedas', +} diff --git a/resources/[essential]/es_extended/locales/de.lua b/resources/[essential]/es_extended/locales/de.lua index 21ec922b..2c6d8d22 100644 --- a/resources/[essential]/es_extended/locales/de.lua +++ b/resources/[essential]/es_extended/locales/de.lua @@ -1,121 +1,121 @@ Locales['de'] = { - ['inventory'] = 'Inventar', - ['use'] = 'benutzen', - ['give'] = 'geben', - ['remove'] = 'entfernen', - ['return'] = 'zurück', - ['amount'] = 'Betrag', - ['amount_invalid'] = 'ungültiger Betrag', - ['players_nearby'] = 'keine Spieler in der Nähe', - ['ex_inv_lim'] = 'Aktion nicht möglich, inventarlimit überschritten für ~b~', - ['yougave'] = 'du gibst', - ['youreceived'] = 'to empfängst', - ['to'] = '~s~ zu ~b~', - ['by'] = '~s~ von ~b~', - ['imp_invalid_quantity'] = 'Aktion nicht möglich, ungültige Anzahl', - ['imp_invalid_amount'] = 'Aktion nicht möglich, ungültiger Betrag', - ['delete_five_min'] = '~r~löschen~s~ in 5 Minuten', - ['threw'] = 'du ~r~wirfst weg~s~', - ['rec_salary'] = 'du hast dein Gehalt erhalten: ', - ['act_imp'] = 'Aktion nicht möglich', - -- Commands - ['setjob'] = 'assign a job to a user', - ['id_param'] = 'the ID of the player', - ['setjob_param2'] = 'the job you wish to assign', - ['setjob_param3'] = 'the job level', - ['load_ipl'] = 'load IPL', - ['unload_ipl'] = 'unload IPL', - ['play_anim'] = 'play animation', - ['play_emote'] = 'play emote', - ['spawn_car'] = 'spawn a car', - ['spawn_car_param'] = 'name of car', - ['givemoney'] = 'give money', - ['money_amount'] = 'amount of money', - ['invalid_account'] = 'invalid account', - ['account'] = 'account', - ['giveaccountmoney'] = 'give account money', - ['invalid_item'] = 'invalid item', - ['item'] = 'item', - ['giveitem'] = 'give item', - ['weapon'] = 'weapon', - ['giveweapon'] = 'give weapon', - -- Weapons - ['weapon_knife'] = 'Messer', - ['weapon_nightstick'] = 'Schlagstock', - ['weapon_hammer'] = 'Hammer', - ['weapon_bat'] = 'Schläger', - ['weapon_golfclub'] = 'Golfschläger', - ['weapon_crowbar'] = 'Brecheisen', - ['weapon_pistol'] = 'Pistole', - ['weapon_combatpistol'] = 'Kampfpistole', - ['weapon_appistol'] = 'AP Pistole', - ['weapon_pistol50'] = 'Pistole .50', - ['weapon_microsmg'] = 'Mikro SMG', - ['weapon_smg'] = 'SMG', - ['weapon_assaultsmg'] = 'Kampf SMG', - ['weapon_assaultrifle'] = 'Kampfgewehr', - ['weapon_carbinerifle'] = 'Karabinergewehr', - ['weapon_advancedrifle'] = 'Advancedgewehr', - ['weapon_mg'] = 'MG', - ['weapon_combatmg'] = 'Kampf MG', - ['weapon_pumpshotgun'] = 'Pumpgun', - ['weapon_sawnoffshotgun'] = 'Abgesägte Schrotflinte', - ['weapon_assaultshotgun'] = 'Kampf Schrotflinte', - ['weapon_bullpupshotgun'] = 'Bullpup Schrotflinte', - ['weapon_stungun'] = 'Tazer', - ['weapon_sniperrifle'] = 'Scharfschützengewehr', - ['weapon_heavysniper'] = 'Schweres Sniper', - ['weapon_remotesniper'] = 'Remote sniper', - ['weapon_grenadelauncher'] = 'Granatwerfer', - ['weapon_rpg'] = 'RPG', - ['weapon_stinger'] = 'Stinger', - ['weapon_minigun'] = 'Minigun', - ['weapon_grenade'] = 'Granate', - ['weapon_stickybomb'] = 'Haftbombe', - ['weapon_smokegrenade'] = 'Rauchgranate', - ['weapon_bzgas'] = 'BZ Gas', - ['weapon_molotov'] = 'Molotov Cocktail', - ['weapon_fireextinguisher'] = 'Feuerlöscher', - ['weapon_petrolcan'] = 'Benzinkanister', - ['weapon_digiscanner'] = 'Digiscanner', - ['weapon_ball'] = 'Ball', - ['weapon_snspistol'] = 'SNS Pistole', - ['weapon_bottle'] = 'Flasche', - ['weapon_gusenberg'] = 'Gusenberg', - ['weapon_specialcarbine'] = 'Spezialkarabiner', - ['weapon_heavypistol'] = 'Schwere Pistole', - ['weapon_bullpuprifle'] = 'Bullpupgewehr', - ['weapon_dagger'] = 'Dolch', - ['weapon_vintagepistol'] = 'Vintage Pistole', - ['weapon_firework'] = 'Feuerwerk', - ['weapon_musket'] = 'Muskete', - ['weapon_heavyshotgun'] = 'Schwere Schrotflinte', - ['weapon_marksmanrifle'] = 'Marksmangewehr', - ['weapon_hominglauncher'] = 'Homing Launcher', - ['weapon_proxmine'] = 'Annäherungsmine', - ['weapon_snowball'] = 'Schneeball', - ['weapon_flaregun'] = 'Leuchtpistole', - ['weapon_garbagebag'] = 'Müllsack', - ['weapon_handcuffs'] = 'Handschellen', - ['weapon_combatpdw'] = 'Kampf PDW', - ['weapon_marksmanpistol'] = 'Marksman Pistole', - ['weapon_knuckle'] = 'Schlagring', - ['weapon_hatchet'] = 'Axt', - ['weapon_railgun'] = 'Railgun', - ['weapon_machete'] = 'Machete', - ['weapon_machinepistol'] = 'Maschinenpistole', - ['weapon_switchblade'] = 'Klappmesser', - ['weapon_revolver'] = 'Schwerer Revolver', - ['weapon_dbshotgun'] = 'Doppelläufige Schrotflinte', - ['weapon_compactrifle'] = 'Kampfgewehr', - ['weapon_autoshotgun'] = 'Auto Shotgun', - ['weapon_battleaxe'] = 'Kampfaxt', - ['weapon_compactlauncher'] = 'Kompakt Launcher', - ['weapon_minismg'] = 'Mini SMG', - ['weapon_pipebomb'] = 'Rohrbombe', - ['weapon_poolcue'] = 'Kö', - ['weapon_wrench'] = 'Rohrzange', - ['weapon_flashlight'] = 'Taschenlampe', - ['gadget_nightvision'] = 'Nachtsichtgerät', - ['gadget_parachute'] = 'Fallschirm', -} \ No newline at end of file + ['inventory'] = 'Inventar', + ['use'] = 'benutzen', + ['give'] = 'geben', + ['remove'] = 'entfernen', + ['return'] = 'zurück', + ['amount'] = 'Betrag', + ['amount_invalid'] = 'ungültiger Betrag', + ['players_nearby'] = 'keine Spieler in der Nähe', + ['ex_inv_lim'] = 'Aktion nicht möglich, inventarlimit überschritten für ~b~', + ['yougave'] = 'du gibst', + ['youreceived'] = 'to empfängst', + ['to'] = '~s~ zu ~b~', + ['by'] = '~s~ von ~b~', + ['imp_invalid_quantity'] = 'Aktion nicht möglich, ungültige Anzahl', + ['imp_invalid_amount'] = 'Aktion nicht möglich, ungültiger Betrag', + ['delete_five_min'] = '~r~löschen~s~ in 5 Minuten', + ['threw'] = 'du ~r~wirfst weg~s~', + ['rec_salary'] = 'du hast dein Gehalt erhalten: ', + ['act_imp'] = 'Aktion nicht möglich', + -- Commands + ['setjob'] = 'assign a job to a user', + ['id_param'] = 'the ID of the player', + ['setjob_param2'] = 'the job you wish to assign', + ['setjob_param3'] = 'the job level', + ['load_ipl'] = 'load IPL', + ['unload_ipl'] = 'unload IPL', + ['play_anim'] = 'play animation', + ['play_emote'] = 'play emote', + ['spawn_car'] = 'spawn a car', + ['spawn_car_param'] = 'name of car', + ['givemoney'] = 'give money', + ['money_amount'] = 'amount of money', + ['invalid_account'] = 'invalid account', + ['account'] = 'account', + ['giveaccountmoney'] = 'give account money', + ['invalid_item'] = 'invalid item', + ['item'] = 'item', + ['giveitem'] = 'give item', + ['weapon'] = 'weapon', + ['giveweapon'] = 'give weapon', + -- Weapons + ['weapon_knife'] = 'Messer', + ['weapon_nightstick'] = 'Schlagstock', + ['weapon_hammer'] = 'Hammer', + ['weapon_bat'] = 'Schläger', + ['weapon_golfclub'] = 'Golfschläger', + ['weapon_crowbar'] = 'Brecheisen', + ['weapon_pistol'] = 'Pistole', + ['weapon_combatpistol'] = 'Kampfpistole', + ['weapon_appistol'] = 'AP Pistole', + ['weapon_pistol50'] = 'Pistole .50', + ['weapon_microsmg'] = 'Mikro SMG', + ['weapon_smg'] = 'SMG', + ['weapon_assaultsmg'] = 'Kampf SMG', + ['weapon_assaultrifle'] = 'Kampfgewehr', + ['weapon_carbinerifle'] = 'Karabinergewehr', + ['weapon_advancedrifle'] = 'Advancedgewehr', + ['weapon_mg'] = 'MG', + ['weapon_combatmg'] = 'Kampf MG', + ['weapon_pumpshotgun'] = 'Pumpgun', + ['weapon_sawnoffshotgun'] = 'Abgesägte Schrotflinte', + ['weapon_assaultshotgun'] = 'Kampf Schrotflinte', + ['weapon_bullpupshotgun'] = 'Bullpup Schrotflinte', + ['weapon_stungun'] = 'Tazer', + ['weapon_sniperrifle'] = 'Scharfschützengewehr', + ['weapon_heavysniper'] = 'Schweres Sniper', + ['weapon_remotesniper'] = 'Remote sniper', + ['weapon_grenadelauncher'] = 'Granatwerfer', + ['weapon_rpg'] = 'RPG', + ['weapon_stinger'] = 'Stinger', + ['weapon_minigun'] = 'Minigun', + ['weapon_grenade'] = 'Granate', + ['weapon_stickybomb'] = 'Haftbombe', + ['weapon_smokegrenade'] = 'Rauchgranate', + ['weapon_bzgas'] = 'BZ Gas', + ['weapon_molotov'] = 'Molotov Cocktail', + ['weapon_fireextinguisher'] = 'Feuerlöscher', + ['weapon_petrolcan'] = 'Benzinkanister', + ['weapon_digiscanner'] = 'Digiscanner', + ['weapon_ball'] = 'Ball', + ['weapon_snspistol'] = 'SNS Pistole', + ['weapon_bottle'] = 'Flasche', + ['weapon_gusenberg'] = 'Gusenberg', + ['weapon_specialcarbine'] = 'Spezialkarabiner', + ['weapon_heavypistol'] = 'Schwere Pistole', + ['weapon_bullpuprifle'] = 'Bullpupgewehr', + ['weapon_dagger'] = 'Dolch', + ['weapon_vintagepistol'] = 'Vintage Pistole', + ['weapon_firework'] = 'Feuerwerk', + ['weapon_musket'] = 'Muskete', + ['weapon_heavyshotgun'] = 'Schwere Schrotflinte', + ['weapon_marksmanrifle'] = 'Marksmangewehr', + ['weapon_hominglauncher'] = 'Homing Launcher', + ['weapon_proxmine'] = 'Annäherungsmine', + ['weapon_snowball'] = 'Schneeball', + ['weapon_flaregun'] = 'Leuchtpistole', + ['weapon_garbagebag'] = 'Müllsack', + ['weapon_handcuffs'] = 'Handschellen', + ['weapon_combatpdw'] = 'Kampf PDW', + ['weapon_marksmanpistol'] = 'Marksman Pistole', + ['weapon_knuckle'] = 'Schlagring', + ['weapon_hatchet'] = 'Axt', + ['weapon_railgun'] = 'Railgun', + ['weapon_machete'] = 'Machete', + ['weapon_machinepistol'] = 'Maschinenpistole', + ['weapon_switchblade'] = 'Klappmesser', + ['weapon_revolver'] = 'Schwerer Revolver', + ['weapon_dbshotgun'] = 'Doppelläufige Schrotflinte', + ['weapon_compactrifle'] = 'Kampfgewehr', + ['weapon_autoshotgun'] = 'Auto Shotgun', + ['weapon_battleaxe'] = 'Kampfaxt', + ['weapon_compactlauncher'] = 'Kompakt Launcher', + ['weapon_minismg'] = 'Mini SMG', + ['weapon_pipebomb'] = 'Rohrbombe', + ['weapon_poolcue'] = 'Kö', + ['weapon_wrench'] = 'Rohrzange', + ['weapon_flashlight'] = 'Taschenlampe', + ['gadget_nightvision'] = 'Nachtsichtgerät', + ['gadget_parachute'] = 'Fallschirm', +} diff --git a/resources/[essential]/es_extended/locales/en.lua b/resources/[essential]/es_extended/locales/en.lua index 6f1c10b4..2ded07f6 100644 --- a/resources/[essential]/es_extended/locales/en.lua +++ b/resources/[essential]/es_extended/locales/en.lua @@ -1,126 +1,126 @@ Locales['en'] = { - ['inventory'] = 'inventory', - ['use'] = 'use', - ['give'] = 'give', - ['remove'] = 'remove', - ['return'] = 'return', - ['amount'] = 'amount', - ['amount_invalid'] = 'invalid amount', - ['players_nearby'] = 'no players nearby', - ['ex_inv_lim'] = 'action not possible, exceeding invetory limit for ~b~', - ['yougave'] = 'you gave', - ['youreceived'] = 'you received', - ['to'] = '~s~ to ~b~', - ['by'] = '~s~ by ~b~', - ['imp_invalid_quantity'] = 'action impossible, invalid quantity', - ['imp_invalid_amount'] = 'action impossible, invalid amount', - ['delete_five_min'] = '~r~delete~s~ in 5 minutes', - ['threw'] = 'you ~r~threw~s~', - ['rec_salary'] = 'you received your salary: ', - ['act_imp'] = 'action impossible', - -- Commands - ['setjob'] = 'assign a job to a user', - ['id_param'] = 'the ID of the player', - ['setjob_param2'] = 'the job you wish to assign', - ['setjob_param3'] = 'the job level', - ['load_ipl'] = 'load IPL', - ['unload_ipl'] = 'unload IPL', - ['play_anim'] = 'play animation', - ['play_emote'] = 'play emote', - ['spawn_car'] = 'spawn a car', - ['spawn_car_param'] = 'name of car', - ['delete_vehicle'] = 'deletes Vehicle', - ['delete_veh_param'] = 'press enter', - ['spawn_object'] = 'spawn object', - ['spawn_ped'] = 'spawn ped', - ['spawn_ped_param'] = 'example a_m_m_hillbilly_01', - ['givemoney'] = 'give money', - ['money_amount'] = 'amount of money', - ['invalid_account'] = 'invalid account', - ['account'] = 'account', - ['giveaccountmoney'] = 'give account money', - ['invalid_item'] = 'invalid item', - ['item'] = 'item', - ['giveitem'] = 'give item', - ['weapon'] = 'weapon', - ['giveweapon'] = 'give weapon', - -- Weapons - ['weapon_knife'] = 'knife', - ['weapon_nightstick'] = 'nightstick', - ['weapon_hammer'] = 'hammer', - ['weapon_bat'] = 'bat', - ['weapon_golfclub'] = 'golf club', - ['weapon_crowbar'] = 'crow bar', - ['weapon_pistol'] = 'pistol', - ['weapon_combatpistol'] = 'combat pistol', - ['weapon_appistol'] = 'ap pistol', - ['weapon_pistol50'] = 'pistol .50', - ['weapon_microsmg'] = 'micro smg', - ['weapon_smg'] = 'smg', - ['weapon_assaultsmg'] = 'assault smg', - ['weapon_assaultrifle'] = 'assault rifle', - ['weapon_carbinerifle'] = 'carbine rifle', - ['weapon_advancedrifle'] = 'advanced rifle', - ['weapon_mg'] = 'mg', - ['weapon_combatmg'] = 'combat mg', - ['weapon_pumpshotgun'] = 'pump shotgun', - ['weapon_sawnoffshotgun'] = 'sawed off shotgun', - ['weapon_assaultshotgun'] = 'assault shotgun', - ['weapon_bullpupshotgun'] = 'bullpup shotgun', - ['weapon_stungun'] = 'tazer', - ['weapon_sniperrifle'] = 'sniper rifle', - ['weapon_heavysniper'] = 'heavy sniper', - ['weapon_remotesniper'] = 'remote sniper', - ['weapon_grenadelauncher'] = 'grenade launcher', - ['weapon_rpg'] = 'rocket launcher', - ['weapon_stinger'] = 'stinger', - ['weapon_minigun'] = 'minigun', - ['weapon_grenade'] = 'grenade', - ['weapon_stickybomb'] = 'sticky bomb', - ['weapon_smokegrenade'] = 'smoke grenade', - ['weapon_bzgas'] = 'bz gas', - ['weapon_molotov'] = 'molotov cocktail', - ['weapon_fireextinguisher'] = 'fire extinguisher', - ['weapon_petrolcan'] = 'jerrycan', - ['weapon_digiscanner'] = 'digiscanner', - ['weapon_ball'] = 'ball', - ['weapon_snspistol'] = 'sns pistol', - ['weapon_bottle'] = 'bottle', - ['weapon_gusenberg'] = 'gusenberg sweeper', - ['weapon_specialcarbine'] = 'special carbine', - ['weapon_heavypistol'] = 'heavy pistol', - ['weapon_bullpuprifle'] = 'bullpup rifle', - ['weapon_dagger'] = 'dagger', - ['weapon_vintagepistol'] = 'vintage pistol', - ['weapon_firework'] = 'firework', - ['weapon_musket'] = 'musket', - ['weapon_heavyshotgun'] = 'heavy shotgun', - ['weapon_marksmanrifle'] = 'marksman rifle', - ['weapon_hominglauncher'] = 'homing launcher', - ['weapon_proxmine'] = 'proximity mine', - ['weapon_snowball'] = 'snow ball', - ['weapon_flaregun'] = 'flaregun', - ['weapon_garbagebag'] = 'garbage bag', - ['weapon_handcuffs'] = 'handcuffs', - ['weapon_combatpdw'] = 'combat pdw', - ['weapon_marksmanpistol'] = 'marksman pistol', - ['weapon_knuckle'] = 'knuckledusters', - ['weapon_hatchet'] = 'hatchet', - ['weapon_railgun'] = 'railgun', - ['weapon_machete'] = 'machete', - ['weapon_machinepistol'] = 'machine pistol', - ['weapon_switchblade'] = 'switchblade', - ['weapon_revolver'] = 'heavy revolver', - ['weapon_dbshotgun'] = 'double barrel shotgun', - ['weapon_compactrifle'] = 'compact rifle', - ['weapon_autoshotgun'] = 'auto shotgun', - ['weapon_battleaxe'] = 'battle axe', - ['weapon_compactlauncher'] = 'compact launcher', - ['weapon_minismg'] = 'mini smg', - ['weapon_pipebomb'] = 'pipe bomb', - ['weapon_poolcue'] = 'pool cue', - ['weapon_wrench'] = 'pipe wrench', - ['weapon_flashlight'] = 'flashlight', - ['gadget_nightvision'] = 'night vision', - ['gadget_parachute'] = 'parachute', + ['inventory'] = 'inventory', + ['use'] = 'use', + ['give'] = 'give', + ['remove'] = 'remove', + ['return'] = 'return', + ['amount'] = 'amount', + ['amount_invalid'] = 'invalid amount', + ['players_nearby'] = 'no players nearby', + ['ex_inv_lim'] = 'action not possible, exceeding invetory limit for ~b~', + ['yougave'] = 'you gave', + ['youreceived'] = 'you received', + ['to'] = '~s~ to ~b~', + ['by'] = '~s~ by ~b~', + ['imp_invalid_quantity'] = 'action impossible, invalid quantity', + ['imp_invalid_amount'] = 'action impossible, invalid amount', + ['delete_five_min'] = '~r~delete~s~ in 5 minutes', + ['threw'] = 'you ~r~threw~s~', + ['rec_salary'] = 'you received your salary: ', + ['act_imp'] = 'action impossible', + -- Commands + ['setjob'] = 'assign a job to a user', + ['id_param'] = 'the ID of the player', + ['setjob_param2'] = 'the job you wish to assign', + ['setjob_param3'] = 'the job level', + ['load_ipl'] = 'load IPL', + ['unload_ipl'] = 'unload IPL', + ['play_anim'] = 'play animation', + ['play_emote'] = 'play emote', + ['spawn_car'] = 'spawn a car', + ['spawn_car_param'] = 'name of car', + ['delete_vehicle'] = 'deletes Vehicle', + ['delete_veh_param'] = 'press enter', + ['spawn_object'] = 'spawn object', + ['spawn_ped'] = 'spawn ped', + ['spawn_ped_param'] = 'example a_m_m_hillbilly_01', + ['givemoney'] = 'give money', + ['money_amount'] = 'amount of money', + ['invalid_account'] = 'invalid account', + ['account'] = 'account', + ['giveaccountmoney'] = 'give account money', + ['invalid_item'] = 'invalid item', + ['item'] = 'item', + ['giveitem'] = 'give item', + ['weapon'] = 'weapon', + ['giveweapon'] = 'give weapon', + -- Weapons + ['weapon_knife'] = 'knife', + ['weapon_nightstick'] = 'nightstick', + ['weapon_hammer'] = 'hammer', + ['weapon_bat'] = 'bat', + ['weapon_golfclub'] = 'golf club', + ['weapon_crowbar'] = 'crow bar', + ['weapon_pistol'] = 'pistol', + ['weapon_combatpistol'] = 'combat pistol', + ['weapon_appistol'] = 'ap pistol', + ['weapon_pistol50'] = 'pistol .50', + ['weapon_microsmg'] = 'micro smg', + ['weapon_smg'] = 'smg', + ['weapon_assaultsmg'] = 'assault smg', + ['weapon_assaultrifle'] = 'assault rifle', + ['weapon_carbinerifle'] = 'carbine rifle', + ['weapon_advancedrifle'] = 'advanced rifle', + ['weapon_mg'] = 'mg', + ['weapon_combatmg'] = 'combat mg', + ['weapon_pumpshotgun'] = 'pump shotgun', + ['weapon_sawnoffshotgun'] = 'sawed off shotgun', + ['weapon_assaultshotgun'] = 'assault shotgun', + ['weapon_bullpupshotgun'] = 'bullpup shotgun', + ['weapon_stungun'] = 'tazer', + ['weapon_sniperrifle'] = 'sniper rifle', + ['weapon_heavysniper'] = 'heavy sniper', + ['weapon_remotesniper'] = 'remote sniper', + ['weapon_grenadelauncher'] = 'grenade launcher', + ['weapon_rpg'] = 'rocket launcher', + ['weapon_stinger'] = 'stinger', + ['weapon_minigun'] = 'minigun', + ['weapon_grenade'] = 'grenade', + ['weapon_stickybomb'] = 'sticky bomb', + ['weapon_smokegrenade'] = 'smoke grenade', + ['weapon_bzgas'] = 'bz gas', + ['weapon_molotov'] = 'molotov cocktail', + ['weapon_fireextinguisher'] = 'fire extinguisher', + ['weapon_petrolcan'] = 'jerrycan', + ['weapon_digiscanner'] = 'digiscanner', + ['weapon_ball'] = 'ball', + ['weapon_snspistol'] = 'sns pistol', + ['weapon_bottle'] = 'bottle', + ['weapon_gusenberg'] = 'gusenberg sweeper', + ['weapon_specialcarbine'] = 'special carbine', + ['weapon_heavypistol'] = 'heavy pistol', + ['weapon_bullpuprifle'] = 'bullpup rifle', + ['weapon_dagger'] = 'dagger', + ['weapon_vintagepistol'] = 'vintage pistol', + ['weapon_firework'] = 'firework', + ['weapon_musket'] = 'musket', + ['weapon_heavyshotgun'] = 'heavy shotgun', + ['weapon_marksmanrifle'] = 'marksman rifle', + ['weapon_hominglauncher'] = 'homing launcher', + ['weapon_proxmine'] = 'proximity mine', + ['weapon_snowball'] = 'snow ball', + ['weapon_flaregun'] = 'flaregun', + ['weapon_garbagebag'] = 'garbage bag', + ['weapon_handcuffs'] = 'handcuffs', + ['weapon_combatpdw'] = 'combat pdw', + ['weapon_marksmanpistol'] = 'marksman pistol', + ['weapon_knuckle'] = 'knuckledusters', + ['weapon_hatchet'] = 'hatchet', + ['weapon_railgun'] = 'railgun', + ['weapon_machete'] = 'machete', + ['weapon_machinepistol'] = 'machine pistol', + ['weapon_switchblade'] = 'switchblade', + ['weapon_revolver'] = 'heavy revolver', + ['weapon_dbshotgun'] = 'double barrel shotgun', + ['weapon_compactrifle'] = 'compact rifle', + ['weapon_autoshotgun'] = 'auto shotgun', + ['weapon_battleaxe'] = 'battle axe', + ['weapon_compactlauncher'] = 'compact launcher', + ['weapon_minismg'] = 'mini smg', + ['weapon_pipebomb'] = 'pipe bomb', + ['weapon_poolcue'] = 'pool cue', + ['weapon_wrench'] = 'pipe wrench', + ['weapon_flashlight'] = 'flashlight', + ['gadget_nightvision'] = 'night vision', + ['gadget_parachute'] = 'parachute', } diff --git a/resources/[essential]/es_extended/locales/fr.lua b/resources/[essential]/es_extended/locales/fr.lua index 1fb41d49..ca81613a 100644 --- a/resources/[essential]/es_extended/locales/fr.lua +++ b/resources/[essential]/es_extended/locales/fr.lua @@ -1,126 +1,126 @@ Locales['fr'] = { - ['inventory'] = 'inventaire', - ['use'] = 'utiliser', - ['give'] = 'donner', - ['remove'] = 'jeter', - ['return'] = 'retour', - ['amount'] = 'quantité', - ['amount_invalid'] = 'montant invalide', - ['players_nearby'] = 'aucun joueur à proximité', - ['ex_inv_lim'] = 'action impossible, depassement de la limite d\'inventaire pour ~b~', - ['yougave'] = 'vous avez donné', - ['youreceived'] = 'vous avez reçu', - ['to'] = '~s~ à ~b~', - ['by'] = '~s~ par ~b~', - ['imp_invalid_quantity'] = 'action impossible, ~r~quantité invalide', - ['imp_invalid_amount'] = 'action impossible, ~r~montant invalide', - ['delete_five_min'] = '~r~suppression~s~ dans 5 minutes', - ['threw'] = 'vous avez ~r~jeté~s~', - ['rec_salary'] = 'vous avez reçu votre salaire : ', - ['act_imp'] = 'action impossible', - -- Commands - ['setjob'] = 'assigner job', - ['id_param'] = 'identification du joueur', - ['setjob_param2'] = 'le travail que vous souhaitez assigner', - ['setjob_param3'] = 'le niveau d\'emploi', - ['load_ipl'] = 'charger IPL', - ['unload_ipl'] = 'décharger IPL', - ['play_anim'] = 'jouer animation', - ['play_emote'] = 'jouer emote', - ['spawn_car'] = 'spawn un véhicule', - ['spawn_car_param'] = 'nom de la voiture', - ['delete_vehicle'] = 'supprimer le véhicule', - ['delete_veh_param'] = 'appuyez sur Entrée', - ['spawn_object'] = 'engendre un objet', - ['spawn_ped'] = 'spawn ped', - ['spawn_ped_param'] = 'example a_m_m_hillbilly_01', - ['givemoney'] = 'donner de l\'argent', - ['money_amount'] = 'somme d\'argent', - ['invalid_account'] = 'compete invalide', - ['account'] = 'compte', - ['giveaccountmoney'] = 'donner de l\'argent au compte', - ['invalid_item'] = 'item invalide', - ['item'] = 'article', - ['giveitem'] = 'donner un article', - ['weapon'] = 'arme', - ['giveweapon'] = 'donner de l\'arme', - -- Weapons - ['weapon_knife'] = 'couteau', - ['weapon_nightstick'] = 'matraque', - ['weapon_hammer'] = 'marteau', - ['weapon_bat'] = 'bat', - ['weapon_golfclub'] = 'club de golfe', - ['weapon_crowbar'] = 'pied de biche', - ['weapon_pistol'] = 'pistolet', - ['weapon_combatpistol'] = 'pistolet de combat', - ['weapon_appistol'] = 'pistolet automatique', - ['weapon_pistol50'] = 'pistolet calibre 50', - ['weapon_microsmg'] = 'micro smg', - ['weapon_smg'] = 'smg', - ['weapon_assaultsmg'] = 'smg d\'assaut', - ['weapon_assaultrifle'] = 'fusil d\'assaut', - ['weapon_carbinerifle'] = 'carabine d\'assaut', - ['weapon_advancedrifle'] = 'fusil avancé', - ['weapon_mg'] = 'mitrailleuse', - ['weapon_combatmg'] = 'mitrailleuse de combat', - ['weapon_pumpshotgun'] = 'fusil à pompe', - ['weapon_sawnoffshotgun'] = 'carabine à canon scié', - ['weapon_assaultshotgun'] = 'carabine d\'assaut', - ['weapon_bullpupshotgun'] = 'carabine bullpup', - ['weapon_stungun'] = 'tazer', - ['weapon_sniperrifle'] = 'fusil de sniper', - ['weapon_heavysniper'] = 'fusil de sniper lourd', - ['weapon_remotesniper'] = 'fusil de sniper à distance', - ['weapon_grenadelauncher'] = 'lance-grenade', - ['weapon_rpg'] = 'lance-rocket', - ['weapon_stinger'] = 'lance-missile stinger', - ['weapon_minigun'] = 'minigun', - ['weapon_grenade'] = 'grenade', - ['weapon_stickybomb'] = 'bombe collante', - ['weapon_smokegrenade'] = 'grenade fumigène', - ['weapon_bzgas'] = 'grenade à gaz bz', - ['weapon_molotov'] = 'cocktail molotov', - ['weapon_fireextinguisher'] = 'extincteur', - ['weapon_petrolcan'] = 'jerrican d\'essence', - ['weapon_digiscanner'] = 'digiscanner', - ['weapon_ball'] = 'balle', - ['weapon_snspistol'] = 'pistolet sns', - ['weapon_bottle'] = 'bouteille', - ['weapon_gusenberg'] = 'balayeuse gusenberg', - ['weapon_specialcarbine'] = 'carabine spéciale', - ['weapon_heavypistol'] = 'pistolet lourd', - ['weapon_bullpuprifle'] = 'fusil bullpup', - ['weapon_dagger'] = 'poignard', - ['weapon_vintagepistol'] = 'pistolet vintage', - ['weapon_firework'] = 'feu d\'artifice', - ['weapon_musket'] = 'mousquet', - ['weapon_heavyshotgun'] = 'fusil à pompe lourd', - ['weapon_marksmanrifle'] = 'fusil marksman', - ['weapon_hominglauncher'] = 'lance tête-chercheuse', - ['weapon_proxmine'] = 'mine de proximité', - ['weapon_snowball'] = 'boule de neige', - ['weapon_flaregun'] = 'lance fusée de détresse', - ['weapon_garbagebag'] = 'sac poubelle', - ['weapon_handcuffs'] = 'menottes', - ['weapon_combatpdw'] = 'arme de défense personnelle', - ['weapon_marksmanpistol'] = 'pistolet marksman', - ['weapon_knuckle'] = 'poing américain', - ['weapon_hatchet'] = 'hachette', - ['weapon_railgun'] = 'canon éléctrique', - ['weapon_machete'] = 'machetta', - ['weapon_machinepistol'] = 'pistolet mitrailleur', - ['weapon_switchblade'] = 'couteau à cran d\'arrêt', - ['weapon_revolver'] = 'revolver', - ['weapon_dbshotgun'] = 'fusil à pompe double canon', - ['weapon_compactrifle'] = 'fusil compact', - ['weapon_autoshotgun'] = 'fusil à pompe automatique', - ['weapon_battleaxe'] = 'hache de combat', - ['weapon_compactlauncher'] = 'lanceur compact', - ['weapon_minismg'] = 'mini smg', - ['weapon_pipebomb'] = 'bombe tuyau', - ['weapon_poolcue'] = 'queue de billard', - ['weapon_wrench'] = 'clé', - ['weapon_flashlight'] = 'lampe torche', - ['gadget_nightvision'] = 'vision nocturne', - ['gadget_parachute'] = 'parachute', + ['inventory'] = 'inventaire', + ['use'] = 'utiliser', + ['give'] = 'donner', + ['remove'] = 'jeter', + ['return'] = 'retour', + ['amount'] = 'quantité', + ['amount_invalid'] = 'montant invalide', + ['players_nearby'] = 'aucun joueur à proximité', + ['ex_inv_lim'] = 'action impossible, depassement de la limite d\'inventaire pour ~b~', + ['yougave'] = 'vous avez donné', + ['youreceived'] = 'vous avez reçu', + ['to'] = '~s~ à ~b~', + ['by'] = '~s~ par ~b~', + ['imp_invalid_quantity'] = 'action impossible, ~r~quantité invalide', + ['imp_invalid_amount'] = 'action impossible, ~r~montant invalide', + ['delete_five_min'] = '~r~suppression~s~ dans 5 minutes', + ['threw'] = 'vous avez ~r~jeté~s~', + ['rec_salary'] = 'vous avez reçu votre salaire : ', + ['act_imp'] = 'action impossible', + -- Commands + ['setjob'] = 'assigner job', + ['id_param'] = 'identification du joueur', + ['setjob_param2'] = 'le travail que vous souhaitez assigner', + ['setjob_param3'] = 'le niveau d\'emploi', + ['load_ipl'] = 'charger IPL', + ['unload_ipl'] = 'décharger IPL', + ['play_anim'] = 'jouer animation', + ['play_emote'] = 'jouer emote', + ['spawn_car'] = 'spawn un véhicule', + ['spawn_car_param'] = 'nom de la voiture', + ['delete_vehicle'] = 'supprimer le véhicule', + ['delete_veh_param'] = 'appuyez sur Entrée', + ['spawn_object'] = 'engendre un objet', + ['spawn_ped'] = 'spawn ped', + ['spawn_ped_param'] = 'example a_m_m_hillbilly_01', + ['givemoney'] = 'donner de l\'argent', + ['money_amount'] = 'somme d\'argent', + ['invalid_account'] = 'compete invalide', + ['account'] = 'compte', + ['giveaccountmoney'] = 'donner de l\'argent au compte', + ['invalid_item'] = 'item invalide', + ['item'] = 'article', + ['giveitem'] = 'donner un article', + ['weapon'] = 'arme', + ['giveweapon'] = 'donner de l\'arme', + -- Weapons + ['weapon_knife'] = 'couteau', + ['weapon_nightstick'] = 'matraque', + ['weapon_hammer'] = 'marteau', + ['weapon_bat'] = 'bat', + ['weapon_golfclub'] = 'club de golfe', + ['weapon_crowbar'] = 'pied de biche', + ['weapon_pistol'] = 'pistolet', + ['weapon_combatpistol'] = 'pistolet de combat', + ['weapon_appistol'] = 'pistolet automatique', + ['weapon_pistol50'] = 'pistolet calibre 50', + ['weapon_microsmg'] = 'micro smg', + ['weapon_smg'] = 'smg', + ['weapon_assaultsmg'] = 'smg d\'assaut', + ['weapon_assaultrifle'] = 'fusil d\'assaut', + ['weapon_carbinerifle'] = 'carabine d\'assaut', + ['weapon_advancedrifle'] = 'fusil avancé', + ['weapon_mg'] = 'mitrailleuse', + ['weapon_combatmg'] = 'mitrailleuse de combat', + ['weapon_pumpshotgun'] = 'fusil à pompe', + ['weapon_sawnoffshotgun'] = 'carabine à canon scié', + ['weapon_assaultshotgun'] = 'carabine d\'assaut', + ['weapon_bullpupshotgun'] = 'carabine bullpup', + ['weapon_stungun'] = 'tazer', + ['weapon_sniperrifle'] = 'fusil de sniper', + ['weapon_heavysniper'] = 'fusil de sniper lourd', + ['weapon_remotesniper'] = 'fusil de sniper à distance', + ['weapon_grenadelauncher'] = 'lance-grenade', + ['weapon_rpg'] = 'lance-rocket', + ['weapon_stinger'] = 'lance-missile stinger', + ['weapon_minigun'] = 'minigun', + ['weapon_grenade'] = 'grenade', + ['weapon_stickybomb'] = 'bombe collante', + ['weapon_smokegrenade'] = 'grenade fumigène', + ['weapon_bzgas'] = 'grenade à gaz bz', + ['weapon_molotov'] = 'cocktail molotov', + ['weapon_fireextinguisher'] = 'extincteur', + ['weapon_petrolcan'] = 'jerrican d\'essence', + ['weapon_digiscanner'] = 'digiscanner', + ['weapon_ball'] = 'balle', + ['weapon_snspistol'] = 'pistolet sns', + ['weapon_bottle'] = 'bouteille', + ['weapon_gusenberg'] = 'balayeuse gusenberg', + ['weapon_specialcarbine'] = 'carabine spéciale', + ['weapon_heavypistol'] = 'pistolet lourd', + ['weapon_bullpuprifle'] = 'fusil bullpup', + ['weapon_dagger'] = 'poignard', + ['weapon_vintagepistol'] = 'pistolet vintage', + ['weapon_firework'] = 'feu d\'artifice', + ['weapon_musket'] = 'mousquet', + ['weapon_heavyshotgun'] = 'fusil à pompe lourd', + ['weapon_marksmanrifle'] = 'fusil marksman', + ['weapon_hominglauncher'] = 'lance tête-chercheuse', + ['weapon_proxmine'] = 'mine de proximité', + ['weapon_snowball'] = 'boule de neige', + ['weapon_flaregun'] = 'lance fusée de détresse', + ['weapon_garbagebag'] = 'sac poubelle', + ['weapon_handcuffs'] = 'menottes', + ['weapon_combatpdw'] = 'arme de défense personnelle', + ['weapon_marksmanpistol'] = 'pistolet marksman', + ['weapon_knuckle'] = 'poing américain', + ['weapon_hatchet'] = 'hachette', + ['weapon_railgun'] = 'canon éléctrique', + ['weapon_machete'] = 'machetta', + ['weapon_machinepistol'] = 'pistolet mitrailleur', + ['weapon_switchblade'] = 'couteau à cran d\'arrêt', + ['weapon_revolver'] = 'revolver', + ['weapon_dbshotgun'] = 'fusil à pompe double canon', + ['weapon_compactrifle'] = 'fusil compact', + ['weapon_autoshotgun'] = 'fusil à pompe automatique', + ['weapon_battleaxe'] = 'hache de combat', + ['weapon_compactlauncher'] = 'lanceur compact', + ['weapon_minismg'] = 'mini smg', + ['weapon_pipebomb'] = 'bombe tuyau', + ['weapon_poolcue'] = 'queue de billard', + ['weapon_wrench'] = 'clé', + ['weapon_flashlight'] = 'lampe torche', + ['gadget_nightvision'] = 'vision nocturne', + ['gadget_parachute'] = 'parachute', } diff --git a/resources/[essential]/es_extended/server/classes/player.lua b/resources/[essential]/es_extended/server/classes/player.lua index 6a29f4f1..b7d365b4 100644 --- a/resources/[essential]/es_extended/server/classes/player.lua +++ b/resources/[essential]/es_extended/server/classes/player.lua @@ -1,426 +1,426 @@ function CreateExtendedPlayer(player, accounts, inventory, job, loadout, name, lastPosition) - local self = {} + local self = {} - self.player = player - self.accounts = accounts - self.inventory = inventory - self.job = job - self.loadout = loadout - self.name = name - self.lastPosition = lastPosition + self.player = player + self.accounts = accounts + self.inventory = inventory + self.job = job + self.loadout = loadout + self.name = name + self.lastPosition = lastPosition - self.source = self.player.get('source') - self.identifier = self.player.get('identifier') - - self.setMoney = function(m) - self.player.setMoney(m) - end - - self.getMoney = function() - return self.player.get('money') - end - - self.setBankBalance = function(m) - self.player.setBankBalance(m) - end - - self.getBank = function() - return self.player.get('bank') - end - - self.getCoords = function() - return self.player.get('coords') - end + self.source = self.player.get('source') + self.identifier = self.player.get('identifier') - self.setCoords = function(x, y, z) - self.player.coords = {x = x, y = y, z = z} - end - - self.kick = function(r) - self.player.kick(r) - end - - self.addMoney = function(m) - self.player.addMoney(m) - end - - self.removeMoney = function(m) - self.player.removeMoney(m) - end - - self.addBank = function(m) - self.player.addBank(m) - end - - self.removeBank = function(m) - self.player.removeBank(m) - end - - self.displayMoney = function(m) - self.player.displayMoney(m) - end - - self.displayBank = function(m) - self.player.displayBank(m) - end - - self.setSessionVar = function(key, value) - self.player.setSessionVar(key, value) - end - - self.getSessionVar = function(k) - return self.player.getSessionVar(k) - end - - self.getPermissions = function() - return self.player.getPermissions() - end - - self.setPermissions = function(p) - self.player.setPermissions(p) - end - - self.getIdentifier = function() - return self.player.getIdentifier() - end - - self.getGroup = function() - return self.player.getGroup() - end - - self.set = function(k, v) - self.player.set(k, v) - end - - self.get = function(k) - return self.player.get(k) - end - - self.getPlayer = function() - return self.player - end + self.setMoney = function(m) + self.player.setMoney(m) + end - self.getAccounts = function() + self.getMoney = function() + return self.player.get('money') + end - local accounts = {} + self.setBankBalance = function(m) + self.player.setBankBalance(m) + end - for i=1, #Config.Accounts, 1 do - - if Config.Accounts[i] == 'bank' then - - table.insert(accounts, { - name = 'bank', - money = self.get('bank'), - label = Config.AccountLabels['bank'] - }) - - else + self.getBank = function() + return self.player.get('bank') + end - for j=1, #self.accounts, 1 do - if self.accounts[j].name == Config.Accounts[i] then - table.insert(accounts, self.accounts[j]) - end - end - - end - end + self.getCoords = function() + return self.player.get('coords') + end - return accounts + self.setCoords = function(x, y, z) + self.player.coords = {x = x, y = y, z = z} + end - end - - self.getAccount = function(a) + self.kick = function(r) + self.player.kick(r) + end - if a == 'bank' then - - return { - name = 'bank', - money = self.get('bank'), - label = Config.AccountLabels['bank'] - } + self.addMoney = function(m) + self.player.addMoney(m) + end - end + self.removeMoney = function(m) + self.player.removeMoney(m) + end - for i=1, #self.accounts, 1 do - if self.accounts[i].name == a then - return self.accounts[i] - end - end - end + self.addBank = function(m) + self.player.addBank(m) + end - self.getInventory = function() - return self.inventory - end + self.removeBank = function(m) + self.player.removeBank(m) + end - self.getJob = function() - return self.job - end + self.displayMoney = function(m) + self.player.displayMoney(m) + end - self.getLoadout = function() - return self.loadout - end + self.displayBank = function(m) + self.player.displayBank(m) + end - self.getName = function() - return self.name - end + self.setSessionVar = function(key, value) + self.player.setSessionVar(key, value) + end - self.getLastPosition = function() - return self.lastPosition - end + self.getSessionVar = function(k) + return self.player.getSessionVar(k) + end - self.getMissingAccounts = function(cb) - - MySQL.Async.fetchAll( - 'SELECT * FROM `user_accounts` WHERE `identifier` = @identifier', - { - ['@identifier'] = self.getIdentifier() - }, - function(result) + self.getPermissions = function() + return self.player.getPermissions() + end - local missingAccounts = {}; + self.setPermissions = function(p) + self.player.setPermissions(p) + end - for i=1, #Config.Accounts, 1 do + self.getIdentifier = function() + return self.player.getIdentifier() + end - if Config.Accounts[i] ~= 'bank' then + self.getGroup = function() + return self.player.getGroup() + end - local found = false + self.set = function(k, v) + self.player.set(k, v) + end - for j=1, #result, 1 do - if Config.Accounts[i] == result[j].name then - found = true - end - end + self.get = function(k) + return self.player.get(k) + end - if not found then - table.insert(missingAccounts, Config.Accounts[i]) - end + self.getPlayer = function() + return self.player + end - end + self.getAccounts = function() - end + local accounts = {} - cb(missingAccounts) + for i=1, #Config.Accounts, 1 do - end - ) + if Config.Accounts[i] == 'bank' then - end + table.insert(accounts, { + name = 'bank', + money = self.get('bank'), + label = Config.AccountLabels['bank'] + }) - self.createAccounts = function(missingAccounts, cb) + else - for i=1, #missingAccounts, 1 do - MySQL.Async.execute( - 'INSERT INTO `user_accounts` (identifier, name) VALUES (@identifier, @name)', - { - ['@identifier'] = self.getIdentifier(), - ['@name'] = missingAccounts[i] - }, - function(rowsChanged) - if cb ~= nil then - cb() - end - end - ) - end + for j=1, #self.accounts, 1 do + if self.accounts[j].name == Config.Accounts[i] then + table.insert(accounts, self.accounts[j]) + end + end - end + end + end - self.setAccountMoney = function(a, m) - - local account = self.getAccount(a) - local prevMoney = account.money - local newMoney = m + return accounts - account.money = newMoney + end - if a == 'bank' then - self.set('bank', newMoney) - end + self.getAccount = function(a) - TriggerClientEvent('esx:setAccountMoney', self.source, account) - end + if a == 'bank' then - self.addAccountMoney = function(a, m) + return { + name = 'bank', + money = self.get('bank'), + label = Config.AccountLabels['bank'] + } - local account = self.getAccount(a) - local newMoney = account.money + m + end - account.money = newMoney + for i=1, #self.accounts, 1 do + if self.accounts[i].name == a then + return self.accounts[i] + end + end + end - if a == 'bank' then - self.set('bank', newMoney) - end + self.getInventory = function() + return self.inventory + end - TriggerClientEvent('esx:setAccountMoney', self.source, account) - end + self.getJob = function() + return self.job + end - self.removeAccountMoney = function(a, m) - local account = self.getAccount(a) - local newMoney = account.money - m + self.getLoadout = function() + return self.loadout + end - account.money = newMoney + self.getName = function() + return self.name + end - if a == 'bank' then - self.set('bank', newMoney) - end + self.getLastPosition = function() + return self.lastPosition + end - TriggerClientEvent('esx:setAccountMoney', self.source, account) - end + self.getMissingAccounts = function(cb) - self.getInventoryItem = function(name) - - for i=1, #self.inventory, 1 do - if self.inventory[i].name == name then - return self.inventory[i] - end - end + MySQL.Async.fetchAll( + 'SELECT * FROM `user_accounts` WHERE `identifier` = @identifier', + { + ['@identifier'] = self.getIdentifier() + }, + function(result) - end + local missingAccounts = {}; - self.addInventoryItem = function(name, count) + for i=1, #Config.Accounts, 1 do - local item = self.getInventoryItem(name) - local newCount = item.count + count - item.count = newCount + if Config.Accounts[i] ~= 'bank' then - TriggerEvent("esx:onAddInventoryItem", self.source, item, count) - TriggerClientEvent("esx:addInventoryItem", self.source, item, count) + local found = false - end + for j=1, #result, 1 do + if Config.Accounts[i] == result[j].name then + found = true + end + end - self.removeInventoryItem = function(name, count) - - local item = self.getInventoryItem(name) - local newCount = item.count - count - item.count = newCount + if not found then + table.insert(missingAccounts, Config.Accounts[i]) + end - TriggerEvent("esx:onRemoveInventoryItem", self.source, item, count) - TriggerClientEvent("esx:removeInventoryItem", self.source, item, count) + end - end + end - self.setInventoryItem = function(name, count) - - local item = self.getInventoryItem(name) - local oldCount = item.count - item.count = count - - if oldCount > item.count then - TriggerEvent("esx:onRemoveInventoryItem", self.source, item, oldCount - item.count ) - TriggerClientEvent("esx:removeInventoryItem", self.source, item, oldCount - item.count ) - else - TriggerEvent("esx:onAddInventoryItem", self.source, item, item.count - oldCount) - TriggerClientEvent("esx:addInventoryItem", self.source, item, item.count - oldCount) - end - - end - - self.setJob = function(name, grade) - - local lastJob = json.decode(json.encode(self.job)) + cb(missingAccounts) - MySQL.Async.fetchAll( - 'SELECT * FROM `jobs` WHERE `name` = @name', - { - ['@name'] = name - }, - function(result) + end + ) - self.job['id'] = result[1].id - self.job['name'] = result[1].name - self.job['label'] = result[1].label + end - MySQL.Async.fetchAll( - 'SELECT * FROM `job_grades` WHERE `job_name` = @job_name AND `grade` = @grade', - { - ['@job_name'] = name, - ['@grade'] = grade - }, - function(result) + self.createAccounts = function(missingAccounts, cb) - self.job['grade'] = grade - self.job['grade_name'] = result[1].name - self.job['grade_label'] = result[1].label - self.job['grade_salary'] = result[1].salary + for i=1, #missingAccounts, 1 do + MySQL.Async.execute( + 'INSERT INTO `user_accounts` (identifier, name) VALUES (@identifier, @name)', + { + ['@identifier'] = self.getIdentifier(), + ['@name'] = missingAccounts[i] + }, + function(rowsChanged) + if cb ~= nil then + cb() + end + end + ) + end - self.job['skin_male'] = nil - self.job['skin_female'] = nil + end - if result[1].skin_male ~= nil then - self.job['skin_male'] = json.decode(result[1].skin_male) - end + self.setAccountMoney = function(a, m) - if result[1].skin_female ~= nil then - self.job['skin_female'] = json.decode(result[1].skin_female) - end + local account = self.getAccount(a) + local prevMoney = account.money + local newMoney = m - TriggerEvent("esx:setJob", self.source, self.job, lastJob) - TriggerClientEvent("esx:setJob", self.source, self.job) + account.money = newMoney - end - ) - - end - ) - - end - - self.addWeapon = function(weaponName, ammo) - - local weaponLabel = weaponName - - for i=1, #Config.Weapons, 1 do - if Config.Weapons[i].name == weaponName then - weaponLabel = Config.Weapons[i].label - break - end - end - - local foundWeapon = false - - for i=1, #self.loadout, 1 do - if self.loadout[i].name == weaponName then - foundWeapon = true - end - end - - if not foundWeapon then - table.insert(self.loadout, { - name = weaponName, - ammo = ammon, - label = weaponLabel - }) - end - - TriggerClientEvent('esx:addWeapon', self.source, weaponName, ammo) - TriggerClientEvent("esx:addInventoryItem", self.source, {label = weaponLabel}, 1) - end - - self.removeWeapon = function(weaponName) - - local weaponLabel = weaponName - - for i=1, #Config.Weapons, 1 do - if Config.Weapons[i].name == weaponName then - weaponLabel = Config.Weapons[i].label - break - end - end - - local foundWeapon = false - - for i=1, #self.loadout, 1 do - if self.loadout[i].name == weaponName then - table.remove(self.loadout, i) - break - end - end - - TriggerClientEvent('esx:removeWeapon', self.source, weaponName) - TriggerClientEvent("esx:removeInventoryItem", self.source, {label = weaponLabel}, 1) - end - - return self - -end \ No newline at end of file + if a == 'bank' then + self.set('bank', newMoney) + end + + TriggerClientEvent('esx:setAccountMoney', self.source, account) + end + + self.addAccountMoney = function(a, m) + + local account = self.getAccount(a) + local newMoney = account.money + m + + account.money = newMoney + + if a == 'bank' then + self.set('bank', newMoney) + end + + TriggerClientEvent('esx:setAccountMoney', self.source, account) + end + + self.removeAccountMoney = function(a, m) + local account = self.getAccount(a) + local newMoney = account.money - m + + account.money = newMoney + + if a == 'bank' then + self.set('bank', newMoney) + end + + TriggerClientEvent('esx:setAccountMoney', self.source, account) + end + + self.getInventoryItem = function(name) + + for i=1, #self.inventory, 1 do + if self.inventory[i].name == name then + return self.inventory[i] + end + end + + end + + self.addInventoryItem = function(name, count) + + local item = self.getInventoryItem(name) + local newCount = item.count + count + item.count = newCount + + TriggerEvent("esx:onAddInventoryItem", self.source, item, count) + TriggerClientEvent("esx:addInventoryItem", self.source, item, count) + + end + + self.removeInventoryItem = function(name, count) + + local item = self.getInventoryItem(name) + local newCount = item.count - count + item.count = newCount + + TriggerEvent("esx:onRemoveInventoryItem", self.source, item, count) + TriggerClientEvent("esx:removeInventoryItem", self.source, item, count) + + end + + self.setInventoryItem = function(name, count) + + local item = self.getInventoryItem(name) + local oldCount = item.count + item.count = count + + if oldCount > item.count then + TriggerEvent("esx:onRemoveInventoryItem", self.source, item, oldCount - item.count ) + TriggerClientEvent("esx:removeInventoryItem", self.source, item, oldCount - item.count ) + else + TriggerEvent("esx:onAddInventoryItem", self.source, item, item.count - oldCount) + TriggerClientEvent("esx:addInventoryItem", self.source, item, item.count - oldCount) + end + + end + + self.setJob = function(name, grade) + + local lastJob = json.decode(json.encode(self.job)) + + MySQL.Async.fetchAll( + 'SELECT * FROM `jobs` WHERE `name` = @name', + { + ['@name'] = name + }, + function(result) + + self.job['id'] = result[1].id + self.job['name'] = result[1].name + self.job['label'] = result[1].label + + MySQL.Async.fetchAll( + 'SELECT * FROM `job_grades` WHERE `job_name` = @job_name AND `grade` = @grade', + { + ['@job_name'] = name, + ['@grade'] = grade + }, + function(result) + + self.job['grade'] = grade + self.job['grade_name'] = result[1].name + self.job['grade_label'] = result[1].label + self.job['grade_salary'] = result[1].salary + + self.job['skin_male'] = nil + self.job['skin_female'] = nil + + if result[1].skin_male ~= nil then + self.job['skin_male'] = json.decode(result[1].skin_male) + end + + if result[1].skin_female ~= nil then + self.job['skin_female'] = json.decode(result[1].skin_female) + end + + TriggerEvent("esx:setJob", self.source, self.job, lastJob) + TriggerClientEvent("esx:setJob", self.source, self.job) + + end + ) + + end + ) + + end + + self.addWeapon = function(weaponName, ammo) + + local weaponLabel = weaponName + + for i=1, #Config.Weapons, 1 do + if Config.Weapons[i].name == weaponName then + weaponLabel = Config.Weapons[i].label + break + end + end + + local foundWeapon = false + + for i=1, #self.loadout, 1 do + if self.loadout[i].name == weaponName then + foundWeapon = true + end + end + + if not foundWeapon then + table.insert(self.loadout, { + name = weaponName, + ammo = ammon, + label = weaponLabel + }) + end + + TriggerClientEvent('esx:addWeapon', self.source, weaponName, ammo) + TriggerClientEvent("esx:addInventoryItem", self.source, {label = weaponLabel}, 1) + end + + self.removeWeapon = function(weaponName) + + local weaponLabel = weaponName + + for i=1, #Config.Weapons, 1 do + if Config.Weapons[i].name == weaponName then + weaponLabel = Config.Weapons[i].label + break + end + end + + local foundWeapon = false + + for i=1, #self.loadout, 1 do + if self.loadout[i].name == weaponName then + table.remove(self.loadout, i) + break + end + end + + TriggerClientEvent('esx:removeWeapon', self.source, weaponName) + TriggerClientEvent("esx:removeInventoryItem", self.source, {label = weaponLabel}, 1) + end + + return self + +end diff --git a/resources/[essential]/es_extended/server/commands.lua b/resources/[essential]/es_extended/server/commands.lua index 814c6d4a..755dea95 100644 --- a/resources/[essential]/es_extended/server/commands.lua +++ b/resources/[essential]/es_extended/server/commands.lua @@ -1,136 +1,136 @@ TriggerEvent('es:addGroupCommand', 'tp', 'admin', function(source, args, user) - TriggerClientEvent("esx:teleport", source, { - x = tonumber(args[2]), - y = tonumber(args[3]), - z = tonumber(args[4]) - }) + TriggerClientEvent("esx:teleport", source, { + x = tonumber(args[2]), + y = tonumber(args[3]), + z = tonumber(args[4]) + }) end, function(source, args, user) - TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Insufficient Permissions.") + TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Insufficient Permissions.") end) TriggerEvent('es:addGroupCommand', 'setjob', 'jobmaster', function(source, args, user) - local xPlayer = ESX.GetPlayerFromId(args[2]) - xPlayer.setJob(args[3], tonumber(args[4])) + local xPlayer = ESX.GetPlayerFromId(args[2]) + xPlayer.setJob(args[3], tonumber(args[4])) end, function(source, args, user) - TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Insufficient Permissions.") + TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Insufficient Permissions.") end, {help = _U('setjob'), params = {{name = "id", help = _U('id_param')}, {name = "job", help = _U('setjob_param2')}, {name = "grade_id", help = _U('setjob_param3')}}}) TriggerEvent('es:addGroupCommand', 'loadipl', 'admin', function(source, args, user) - TriggerClientEvent('esx:loadIPL', -1, args[2]) + TriggerClientEvent('esx:loadIPL', -1, args[2]) end, function(source, args, user) - TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Insufficient Permissions.") + TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Insufficient Permissions.") end, {help = _U('load_ipl')}) TriggerEvent('es:addGroupCommand', 'unloadipl', 'admin', function(source, args, user) - TriggerClientEvent('esx:unloadIPL', -1, args[2]) + TriggerClientEvent('esx:unloadIPL', -1, args[2]) end, function(source, args, user) - TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Insufficient Permissions.") + TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Insufficient Permissions.") end, {help = _U('unload_ipl')}) TriggerEvent('es:addGroupCommand', 'playanim', 'admin', function(source, args, user) - TriggerClientEvent('esx:playAnim', -1, args[2], args[3]) + TriggerClientEvent('esx:playAnim', -1, args[2], args[3]) end, function(source, args, user) - TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Insufficient Permissions.") + TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Insufficient Permissions.") end, {help = _U('play_anim')}) TriggerEvent('es:addGroupCommand', 'playemote', 'admin', function(source, args, user) - TriggerClientEvent('esx:playEmote', -1, args[2]) + TriggerClientEvent('esx:playEmote', -1, args[2]) end, function(source, args, user) - TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Insufficient Permissions.") + TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Insufficient Permissions.") end, {help = _U('play_emote')}) TriggerEvent('es:addGroupCommand', 'car', 'admin', function(source, args, user) - TriggerClientEvent('esx:spawnVehicle', source, args[2]) + TriggerClientEvent('esx:spawnVehicle', source, args[2]) end, function(source, args, user) - TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Insufficient Permissions.") + TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Insufficient Permissions.") end, {help = _U('spawn_car'), params = {{name = "car", help = _U('spawn_car_param')}}}) TriggerEvent('es:addGroupCommand', 'dv', 'admin', function(source, args, user) - TriggerClientEvent('esx:deleteVehicle', source) + TriggerClientEvent('esx:deleteVehicle', source) end, function(source, args, user) - TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Insufficient Permissions.") + TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Insufficient Permissions.") end, {help = _U('delete_vehicle'), params = {{name = "car", help = _U('delete_veh_param')}}}) TriggerEvent('es:addGroupCommand', 'spawnped', 'admin', function(source, args, user) - TriggerClientEvent('esx:spawnPed', source, args[2]) + TriggerClientEvent('esx:spawnPed', source, args[2]) end, function(source, args, user) - TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Insufficient Permissions.") + TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Insufficient Permissions.") end, {help = _U('spawn_ped'), params = {{name = "name", help = _U('spawn_ped_param')}}}) TriggerEvent('es:addGroupCommand', 'spawnobject', 'admin', function(source, args, user) - TriggerClientEvent('esx:spawnObject', source, args[2]) + TriggerClientEvent('esx:spawnObject', source, args[2]) end, function(source, args, user) - TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Insufficient Permissions.") + TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Insufficient Permissions.") end, {help = _U('spawn_object'), params = {{name = "name"}}}) TriggerEvent('es:addGroupCommand', 'givemoney', 'admin', function(source, args, user) - - local _source = source - local xPlayer = ESX.GetPlayerFromId(args[2]) - local amount = tonumber(args[3]) - - if amount ~= nil then - xPlayer.addMoney(amount) - else - TriggerClientEvent('esx:showNotification', _source, _U('amount_invalid')) - end + + local _source = source + local xPlayer = ESX.GetPlayerFromId(args[2]) + local amount = tonumber(args[3]) + + if amount ~= nil then + xPlayer.addMoney(amount) + else + TriggerClientEvent('esx:showNotification', _source, _U('amount_invalid')) + end end, function(source, args, user) - TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Insufficient Permissions.") + TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Insufficient Permissions.") end, {help = _U('givemoney'), params = {{name = "id", help = _U('id_param')}, {name = "amount", help = _U('money_amount')}}}) TriggerEvent('es:addGroupCommand', 'giveaccountmoney', 'admin', function(source, args, user) - - local _source = source - local xPlayer = ESX.GetPlayerFromId(args[2]) - local account = args[3] - local amount = tonumber(args[4]) - - if amount ~= nil then - if xPlayer.getAccount(account) ~= nil then - xPlayer.addAccountMoney(account, amount) - else - TriggerClientEvent('esx:showNotification', _source, _U('invalid_account')) - end - else - TriggerClientEvent('esx:showNotification', _source, _U('amount_invalid')) - end + + local _source = source + local xPlayer = ESX.GetPlayerFromId(args[2]) + local account = args[3] + local amount = tonumber(args[4]) + + if amount ~= nil then + if xPlayer.getAccount(account) ~= nil then + xPlayer.addAccountMoney(account, amount) + else + TriggerClientEvent('esx:showNotification', _source, _U('invalid_account')) + end + else + TriggerClientEvent('esx:showNotification', _source, _U('amount_invalid')) + end end, function(source, args, user) - TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Insufficient Permissions.") + TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Insufficient Permissions.") end, {help = _U('giveaccountmoney'), params = {{name = "id", help = _U('id_param')}, {name = "account", help = _U('account')}, {name = "amount", help = _U('money_amount')}}}) TriggerEvent('es:addGroupCommand', 'giveitem', 'admin', function(source, args, user) - - local _source = source - local xPlayer = ESX.GetPlayerFromId(args[2]) - local item = args[3] - local count = (args[4] == nil and 1 or tonumber(args[4])) - - if count ~= nil then - if xPlayer.getInventoryItem(item) ~= nil then - xPlayer.addInventoryItem(item, count) - else - TriggerClientEvent('esx:showNotification', _source, _U('invalid_item')) - end - else - TriggerClientEvent('esx:showNotification', _source, _U('invalid_amount')) - end + + local _source = source + local xPlayer = ESX.GetPlayerFromId(args[2]) + local item = args[3] + local count = (args[4] == nil and 1 or tonumber(args[4])) + + if count ~= nil then + if xPlayer.getInventoryItem(item) ~= nil then + xPlayer.addInventoryItem(item, count) + else + TriggerClientEvent('esx:showNotification', _source, _U('invalid_item')) + end + else + TriggerClientEvent('esx:showNotification', _source, _U('invalid_amount')) + end end, function(source, args, user) - TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Insufficient Permissions.") + TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Insufficient Permissions.") end, {help = _U('giveitem'), params = {{name = "id", help = _U('id_param')}, {name = "item", help = _U('item')}, {name = "amount", help = _U('amount')}}}) TriggerEvent('es:addGroupCommand', 'giveweapon', 'admin', function(source, args, user) - - local xPlayer = ESX.GetPlayerFromId(args[2]) - local weaponName = string.upper(args[3]) - - xPlayer.addWeapon(weaponName, 1000) + + local xPlayer = ESX.GetPlayerFromId(args[2]) + local weaponName = string.upper(args[3]) + + xPlayer.addWeapon(weaponName, 1000) end, function(source, args, user) - TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Insufficient Permissions.") -end, {help = _U('giveweapon'), params = {{name = "id", help = _U('id_param')}, {name = "weapon", help = _U('weapon')}}}) \ No newline at end of file + TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "Insufficient Permissions.") +end, {help = _U('giveweapon'), params = {{name = "id", help = _U('id_param')}, {name = "weapon", help = _U('weapon')}}}) diff --git a/resources/[essential]/es_extended/server/common.lua b/resources/[essential]/es_extended/server/common.lua index f8b1c72d..4bde6732 100644 --- a/resources/[essential]/es_extended/server/common.lua +++ b/resources/[essential]/es_extended/server/common.lua @@ -9,93 +9,93 @@ ESX.Pickups = {} ESX.PickupId = 0 AddEventHandler('esx:getSharedObject', function(cb) - cb(ESX) + cb(ESX) end) function getSharedObject() - return ESX + return ESX end AddEventHandler('onMySQLReady', function () - MySQL.Async.fetchAll( - 'SELECT * FROM items', - {}, - function(result) + MySQL.Async.fetchAll( + 'SELECT * FROM items', + {}, + function(result) - for i=1, #result, 1 do - ESX.Items[result[i].name] = { - label = result[i].label, - limit = result[i].limit, - rare = (result[i].rare == 1 and true or false), - canRemove = (result[i].can_remove == 1 and true or false), - } - end + for i=1, #result, 1 do + ESX.Items[result[i].name] = { + label = result[i].label, + limit = result[i].limit, + rare = (result[i].rare == 1 and true or false), + canRemove = (result[i].can_remove == 1 and true or false), + } + end - end - ) + end + ) end) AddEventHandler('esx:playerLoaded', function(source) - local xPlayer = ESX.GetPlayerFromId(source) - local accounts = {} - local items = {} - local xPlayerAccounts = xPlayer.getAccounts() - local xPlayerItems = xPlayer.getInventory() + local xPlayer = ESX.GetPlayerFromId(source) + local accounts = {} + local items = {} + local xPlayerAccounts = xPlayer.getAccounts() + local xPlayerItems = xPlayer.getInventory() - for i=1, #xPlayerAccounts, 1 do - accounts[xPlayerAccounts[i].name] = xPlayerAccounts[i].money - end + for i=1, #xPlayerAccounts, 1 do + accounts[xPlayerAccounts[i].name] = xPlayerAccounts[i].money + end - for i=1, #xPlayerItems, 1 do - items[xPlayerItems[i].name] = xPlayerItems[i].count - end + for i=1, #xPlayerItems, 1 do + items[xPlayerItems[i].name] = xPlayerItems[i].count + end - ESX.LastPlayerData[source] = { - accounts = accounts, - items = items - } + ESX.LastPlayerData[source] = { + accounts = accounts, + items = items + } end) RegisterServerEvent('esx:clientLog') AddEventHandler('esx:clientLog', function(msg) - RconPrint(msg .. "\n") + RconPrint(msg .. "\n") end) RegisterServerEvent('esx:triggerServerCallback') AddEventHandler('esx:triggerServerCallback', function(name, requestId, ...) - - local _source = source - - ESX.TriggerServerCallback(name, requestID, _source, function(...) - TriggerClientEvent('esx:serverCallback', _source, requestId, ...) - end, ...) + + local _source = source + + ESX.TriggerServerCallback(name, requestID, _source, function(...) + TriggerClientEvent('esx:serverCallback', _source, requestId, ...) + end, ...) end) -- SetTimeout CreateThread(function() - while true do + while true do - Wait(0) + Wait(0) - local currTime = os.clock() * 1000 + local currTime = os.clock() * 1000 - for i=1, #ESX.TimeoutCallbacks, 1 do + for i=1, #ESX.TimeoutCallbacks, 1 do - if ESX.TimeoutCallbacks[i] ~= nil then + if ESX.TimeoutCallbacks[i] ~= nil then - if currTime >= ESX.TimeoutCallbacks[i].time then - ESX.TimeoutCallbacks[i].cb() - ESX.TimeoutCallbacks[i] = nil - end + if currTime >= ESX.TimeoutCallbacks[i].time then + ESX.TimeoutCallbacks[i].cb() + ESX.TimeoutCallbacks[i] = nil + end - end + end - end + end - end + end end) diff --git a/resources/[essential]/es_extended/server/functions.lua b/resources/[essential]/es_extended/server/functions.lua index ffbbe1dd..f5dfb5ed 100644 --- a/resources/[essential]/es_extended/server/functions.lua +++ b/resources/[essential]/es_extended/server/functions.lua @@ -5,13 +5,13 @@ for i = 65, 90 do table.insert(Charset, string.char(i)) end for i = 97, 122 do table.insert(Charset, string.char(i)) end ESX.Trace = function(str) - if Config.EnableDebug then - print('ESX> ' .. str) - end + if Config.EnableDebug then + print('ESX> ' .. str) + end end ESX.GetConfig = function() - return Config + return Config end ESX.GetRandomString = function(length) @@ -23,224 +23,224 @@ ESX.GetRandomString = function(length) else return '' end - + end ESX.SetTimeout = function(msec, cb) - table.insert(ESX.TimeoutCallbacks, { - time = os.clock() * 1000 + msec, - cb = cb - }) - return #ESX.TimeoutCallbacks + table.insert(ESX.TimeoutCallbacks, { + time = os.clock() * 1000 + msec, + cb = cb + }) + return #ESX.TimeoutCallbacks end ESX.ClearTimeout = function(i) - ESX.TimeoutCallbacks[i] = nil + ESX.TimeoutCallbacks[i] = nil end ESX.RegisterServerCallback = function(name, cb) - ESX.ServerCallbacks[name] = cb + ESX.ServerCallbacks[name] = cb end ESX.TriggerServerCallback = function(name, requestId, source, cb, ...) - - if ESX.ServerCallbacks[name] ~= nil then - ESX.ServerCallbacks[name](source, cb, ...) - else - print('TriggerServerCallback => [' .. name .. '] does not exists') - end + + if ESX.ServerCallbacks[name] ~= nil then + ESX.ServerCallbacks[name](source, cb, ...) + else + print('TriggerServerCallback => [' .. name .. '] does not exists') + end end ESX.SavePlayer = function(xPlayer, cb) - local asyncTasks = {} - xPlayer.lastPosition = xPlayer.get('coords') + local asyncTasks = {} + xPlayer.lastPosition = xPlayer.get('coords') - -- User accounts - for i=1, #xPlayer.accounts, 1 do + -- User accounts + for i=1, #xPlayer.accounts, 1 do - if ESX.LastPlayerData[xPlayer.source].accounts[xPlayer.accounts[i].name] ~= xPlayer.accounts[i].money then + if ESX.LastPlayerData[xPlayer.source].accounts[xPlayer.accounts[i].name] ~= xPlayer.accounts[i].money then - table.insert(asyncTasks, function(cb) + table.insert(asyncTasks, function(cb) - MySQL.Async.execute( - 'UPDATE user_accounts SET `money` = @money WHERE identifier = @identifier AND name = @name', - { - ['@money'] = xPlayer.accounts[i].money, - ['@identifier'] = xPlayer.identifier, - ['@name'] = xPlayer.accounts[i].name - }, - function(rowsChanged) - cb() - end - ) + MySQL.Async.execute( + 'UPDATE user_accounts SET `money` = @money WHERE identifier = @identifier AND name = @name', + { + ['@money'] = xPlayer.accounts[i].money, + ['@identifier'] = xPlayer.identifier, + ['@name'] = xPlayer.accounts[i].name + }, + function(rowsChanged) + cb() + end + ) - end) + end) - ESX.LastPlayerData[xPlayer.source].accounts[xPlayer.accounts[i].name] = xPlayer.accounts[i].money + ESX.LastPlayerData[xPlayer.source].accounts[xPlayer.accounts[i].name] = xPlayer.accounts[i].money - end + end - end + end - -- Inventory items - for i=1, #xPlayer.inventory, 1 do + -- Inventory items + for i=1, #xPlayer.inventory, 1 do - if ESX.LastPlayerData[xPlayer.source].items[xPlayer.inventory[i].name] ~= xPlayer.inventory[i].count then + if ESX.LastPlayerData[xPlayer.source].items[xPlayer.inventory[i].name] ~= xPlayer.inventory[i].count then - table.insert(asyncTasks, function(cb) + table.insert(asyncTasks, function(cb) - MySQL.Async.execute( - 'UPDATE user_inventory SET `count` = @count WHERE identifier = @identifier AND item = @item', - { - ['@count'] = xPlayer.inventory[i].count, - ['@identifier'] = xPlayer.identifier, - ['@item'] = xPlayer.inventory[i].name - }, - function(rowsChanged) - cb() - end - ) + MySQL.Async.execute( + 'UPDATE user_inventory SET `count` = @count WHERE identifier = @identifier AND item = @item', + { + ['@count'] = xPlayer.inventory[i].count, + ['@identifier'] = xPlayer.identifier, + ['@item'] = xPlayer.inventory[i].name + }, + function(rowsChanged) + cb() + end + ) - end) + end) - ESX.LastPlayerData[xPlayer.source].items[xPlayer.inventory[i].name] = xPlayer.inventory[i].count + ESX.LastPlayerData[xPlayer.source].items[xPlayer.inventory[i].name] = xPlayer.inventory[i].count - end + end - end + end - -- Job, loadout and position - table.insert(asyncTasks, function(cb) + -- Job, loadout and position + table.insert(asyncTasks, function(cb) - MySQL.Async.execute( - 'UPDATE users SET `job` = @job, `job_grade` = @job_grade, `loadout` = @loadout, `position` = @position WHERE identifier = @identifier', - { - ['@job'] = xPlayer.job.name, - ['@job_grade'] = xPlayer.job.grade, - ['@loadout'] = json.encode(xPlayer.loadout), - ['@position'] = json.encode(xPlayer.lastPosition), - ['@identifier'] = xPlayer.identifier - }, - function(rowsChanged) - cb() - end - ) + MySQL.Async.execute( + 'UPDATE users SET `job` = @job, `job_grade` = @job_grade, `loadout` = @loadout, `position` = @position WHERE identifier = @identifier', + { + ['@job'] = xPlayer.job.name, + ['@job_grade'] = xPlayer.job.grade, + ['@loadout'] = json.encode(xPlayer.loadout), + ['@position'] = json.encode(xPlayer.lastPosition), + ['@identifier'] = xPlayer.identifier + }, + function(rowsChanged) + cb() + end + ) - end) + end) - Async.parallel(asyncTasks, function(results) - - RconPrint('[SAVED] ' .. xPlayer.name .. "\n") + Async.parallel(asyncTasks, function(results) - if cb ~= nil then - cb() - end + RconPrint('[SAVED] ' .. xPlayer.name .. "\n") - end) + if cb ~= nil then + cb() + end + + end) end ESX.SavePlayers = function(cb) - local asyncTasks = {} - local xPlayers = ESX.GetPlayers() + local asyncTasks = {} + local xPlayers = ESX.GetPlayers() - for i=1, #xPlayers, 1 do - table.insert(asyncTasks, function(cb) - local xPlayer = ESX.GetPlayerFromId(xPlayers[i]) - ESX.SavePlayer(xPlayer, cb) - end) - end + for i=1, #xPlayers, 1 do + table.insert(asyncTasks, function(cb) + local xPlayer = ESX.GetPlayerFromId(xPlayers[i]) + ESX.SavePlayer(xPlayer, cb) + end) + end - Async.parallelLimit(asyncTasks, 8, function(results) - - RconPrint('[SAVED] All players' .. "\n") + Async.parallelLimit(asyncTasks, 8, function(results) - if cb ~= nil then - cb() - end + RconPrint('[SAVED] All players' .. "\n") - end) + if cb ~= nil then + cb() + end + + end) end ESX.StartDBSync = function() - - function saveData() - ESX.SavePlayers() - SetTimeout(10 * 60 * 1000, saveData) - end - SetTimeout(10 * 60 * 1000, saveData) + function saveData() + ESX.SavePlayers() + SetTimeout(10 * 60 * 1000, saveData) + end + + SetTimeout(10 * 60 * 1000, saveData) end ESX.GetPlayers = function() - local sources = {} + local sources = {} - for k,v in pairs(ESX.Players) do - table.insert(sources, k) - end + for k,v in pairs(ESX.Players) do + table.insert(sources, k) + end - return sources + return sources end ESX.GetPlayerFromId = function(source) - return ESX.Players[tonumber(source)] + return ESX.Players[tonumber(source)] end ESX.GetPlayerFromIdentifier = function(identifier) - - for k,v in pairs(ESX.Players) do - if v.identifier == identifier then - return v - end - end + + for k,v in pairs(ESX.Players) do + if v.identifier == identifier then + return v + end + end end ESX.RegisterUsableItem = function(item, cb) - ESX.UsableItemsCallbacks[item] = cb + ESX.UsableItemsCallbacks[item] = cb end ESX.UseItem = function(source, item) - ESX.UsableItemsCallbacks[item](source) + ESX.UsableItemsCallbacks[item](source) end ESX.GetWeaponList = function() - return Config.Weapons + return Config.Weapons end ESX.GetWeaponLabel = function(name) - - name = string.upper(name) - local weapons = ESX.GetWeaponList() - - for i=1, #weapons, 1 do - if weapons[i].name == name then - return weapons[i].label - end - end + + name = string.upper(name) + local weapons = ESX.GetWeaponList() + + for i=1, #weapons, 1 do + if weapons[i].name == name then + return weapons[i].label + end + end end ESX.CreatePickup = function(type, name, count, label, player) - local pickupId = (ESX.PickupId == 65635 and 0 or ESX.PickupId + 1) + local pickupId = (ESX.PickupId == 65635 and 0 or ESX.PickupId + 1) - ESX.Pickups[pickupId] = { - type = type, - name = name, - count = count - } + ESX.Pickups[pickupId] = { + type = type, + name = name, + count = count + } - TriggerClientEvent('esx:pickup', -1, pickupId, label, player) + TriggerClientEvent('esx:pickup', -1, pickupId, label, player) - ESX.PickupId = pickupId + ESX.PickupId = pickupId end diff --git a/resources/[essential]/es_extended/server/main.lua b/resources/[essential]/es_extended/server/main.lua index e30ae8ef..7db15f56 100644 --- a/resources/[essential]/es_extended/server/main.lua +++ b/resources/[essential]/es_extended/server/main.lua @@ -1,587 +1,587 @@ AddEventHandler('es:playerLoaded', function(source, _player) - local _source = source - local tasks = {} + local _source = source + local tasks = {} - local userData = { - accounts = {}, - inventory = {}, - job = {}, - loadout = {}, - playerName = GetPlayerName(_source), - lastPosition = nil - } + local userData = { + accounts = {}, + inventory = {}, + job = {}, + loadout = {}, + playerName = GetPlayerName(_source), + lastPosition = nil + } - TriggerEvent('es:getPlayerFromId', _source, function(player) + TriggerEvent('es:getPlayerFromId', _source, function(player) - -- Update user name in DB - table.insert(tasks, function(cb) + -- Update user name in DB + table.insert(tasks, function(cb) - MySQL.Async.execute( - 'UPDATE `users` SET `name` = @name WHERE `identifier` = @identifier', - { - ['@identifier'] = player.getIdentifier(), - ['@name'] = userData.playerName - }, - function(rowsChanged) - cb() - end - ) + MySQL.Async.execute( + 'UPDATE `users` SET `name` = @name WHERE `identifier` = @identifier', + { + ['@identifier'] = player.getIdentifier(), + ['@name'] = userData.playerName + }, + function(rowsChanged) + cb() + end + ) - end) + end) - -- Get accounts - table.insert(tasks, function(cb) + -- Get accounts + table.insert(tasks, function(cb) - MySQL.Async.fetchAll( - 'SELECT * FROM `user_accounts` WHERE `identifier` = @identifier', - { - ['@identifier'] = player.getIdentifier() - }, - function(accounts) + MySQL.Async.fetchAll( + 'SELECT * FROM `user_accounts` WHERE `identifier` = @identifier', + { + ['@identifier'] = player.getIdentifier() + }, + function(accounts) - for i=1, #Config.Accounts, 1 do - for j=1, #accounts, 1 do - if accounts[j].name == Config.Accounts[i] then - table.insert(userData.accounts, { - name = accounts[j].name, - money = accounts[j].money, - label = Config.AccountLabels[accounts[j].name] - }) - end - end + for i=1, #Config.Accounts, 1 do + for j=1, #accounts, 1 do + if accounts[j].name == Config.Accounts[i] then + table.insert(userData.accounts, { + name = accounts[j].name, + money = accounts[j].money, + label = Config.AccountLabels[accounts[j].name] + }) + end + end - end + end - cb() - end - ) + cb() + end + ) - end) + end) - -- Get Inventory - table.insert(tasks, function(cb) + -- Get Inventory + table.insert(tasks, function(cb) - MySQL.Async.fetchAll( - 'SELECT * FROM `user_inventory` WHERE `identifier` = @identifier', - { - ['@identifier'] = player.getIdentifier() - }, - function(inventory) - - for i=1, #inventory, 1 do - table.insert(userData.inventory, { - name = inventory[i].item, - count = inventory[i].count, - label = ESX.Items[inventory[i].item].label, - limit = ESX.Items[inventory[i].item].limit, - usable = ESX.UsableItemsCallbacks[inventory[i].item] ~= nil, - rare = ESX.Items[inventory[i].item].rare, - canRemove = ESX.Items[inventory[i].item].canRemove, - }) - end + MySQL.Async.fetchAll( + 'SELECT * FROM `user_inventory` WHERE `identifier` = @identifier', + { + ['@identifier'] = player.getIdentifier() + }, + function(inventory) - for k,v in pairs(ESX.Items) do + for i=1, #inventory, 1 do + table.insert(userData.inventory, { + name = inventory[i].item, + count = inventory[i].count, + label = ESX.Items[inventory[i].item].label, + limit = ESX.Items[inventory[i].item].limit, + usable = ESX.UsableItemsCallbacks[inventory[i].item] ~= nil, + rare = ESX.Items[inventory[i].item].rare, + canRemove = ESX.Items[inventory[i].item].canRemove, + }) + end - local found = false + for k,v in pairs(ESX.Items) do - for j=1, #userData.inventory, 1 do - if userData.inventory[j].name == k then - found = true - break - end - end + local found = false - if not found then - - table.insert(userData.inventory, { - name = k, - count = 0, - label = ESX.Items[k].label, - limit = ESX.Items[k].limit, - usable = ESX.UsableItemsCallbacks[k] ~= nil, - rare = ESX.Items[k].rare, - canRemove = ESX.Items[k].canRemove, - }) + for j=1, #userData.inventory, 1 do + if userData.inventory[j].name == k then + found = true + break + end + end - MySQL.Async.execute( - 'INSERT INTO user_inventory (identifier, item, count) VALUES (@identifier, @item, @count)', - { - ['@identifier'] = player.getIdentifier(), - ['@item'] = k, - ['@count'] = 0 - } - ) + if not found then - end + table.insert(userData.inventory, { + name = k, + count = 0, + label = ESX.Items[k].label, + limit = ESX.Items[k].limit, + usable = ESX.UsableItemsCallbacks[k] ~= nil, + rare = ESX.Items[k].rare, + canRemove = ESX.Items[k].canRemove, + }) - end + MySQL.Async.execute( + 'INSERT INTO user_inventory (identifier, item, count) VALUES (@identifier, @item, @count)', + { + ['@identifier'] = player.getIdentifier(), + ['@item'] = k, + ['@count'] = 0 + } + ) - table.sort(userData.inventory, function(a,b) - return a.label < b.label - end) + end - cb() - end - ) + end - end) + table.sort(userData.inventory, function(a,b) + return a.label < b.label + end) - -- Get job and loadout - table.insert(tasks, function(cb) + cb() + end + ) - local tasks2 = {} + end) - -- Get job name, grade and last position - table.insert(tasks2, function(cb2) + -- Get job and loadout + table.insert(tasks, function(cb) - MySQL.Async.fetchAll( - 'SELECT * FROM `users` WHERE `identifier` = @identifier', - { - ['@identifier'] = player.getIdentifier() - }, - function(result) - - userData.job['name'] = result[1].job - userData.job['grade'] = result[1].job_grade + local tasks2 = {} - if result[1].loadout ~= nil then - userData.loadout = json.decode(result[1].loadout) - end + -- Get job name, grade and last position + table.insert(tasks2, function(cb2) - if result[1].position ~= nil then - userData.lastPosition = json.decode(result[1].position) - end + MySQL.Async.fetchAll( + 'SELECT * FROM `users` WHERE `identifier` = @identifier', + { + ['@identifier'] = player.getIdentifier() + }, + function(result) - cb2() + userData.job['name'] = result[1].job + userData.job['grade'] = result[1].job_grade - end - ) + if result[1].loadout ~= nil then + userData.loadout = json.decode(result[1].loadout) + end - end) + if result[1].position ~= nil then + userData.lastPosition = json.decode(result[1].position) + end - -- Get job label - table.insert(tasks2, function(cb2) + cb2() - MySQL.Async.fetchAll( - 'SELECT * FROM `jobs` WHERE `name` = @name', - { - ['@name'] = userData.job.name - }, - function(result) - - userData.job['label'] = result[1].label + end + ) - cb2() + end) - end - ) + -- Get job label + table.insert(tasks2, function(cb2) - end) + MySQL.Async.fetchAll( + 'SELECT * FROM `jobs` WHERE `name` = @name', + { + ['@name'] = userData.job.name + }, + function(result) - -- Get job grade data - table.insert(tasks2, function(cb2) + userData.job['label'] = result[1].label - MySQL.Async.fetchAll( - 'SELECT * FROM `job_grades` WHERE `job_name` = @job_name AND `grade` = @grade', - { - ['@job_name'] = userData.job.name, - ['@grade'] = userData.job.grade - }, - function(result) - - userData.job['grade_name'] = result[1].name - userData.job['grade_label'] = result[1].label - userData.job['grade_salary'] = result[1].salary + cb2() - userData.job['skin_male'] = {} - userData.job['skin_female'] = {} + end + ) - if result[1].skin_male ~= nil then - userData.job['skin_male'] = json.decode(result[1].skin_male) - end + end) - if result[1].skin_female ~= nil then - userData.job['skin_female'] = json.decode(result[1].skin_female) - end + -- Get job grade data + table.insert(tasks2, function(cb2) - cb2() + MySQL.Async.fetchAll( + 'SELECT * FROM `job_grades` WHERE `job_name` = @job_name AND `grade` = @grade', + { + ['@job_name'] = userData.job.name, + ['@grade'] = userData.job.grade + }, + function(result) - end - ) + userData.job['grade_name'] = result[1].name + userData.job['grade_label'] = result[1].label + userData.job['grade_salary'] = result[1].salary - end) + userData.job['skin_male'] = {} + userData.job['skin_female'] = {} - Async.series(tasks2, cb) + if result[1].skin_male ~= nil then + userData.job['skin_male'] = json.decode(result[1].skin_male) + end - end) + if result[1].skin_female ~= nil then + userData.job['skin_female'] = json.decode(result[1].skin_female) + end - -- Run Tasks - Async.parallel(tasks, function(results) + cb2() - local xPlayer = CreateExtendedPlayer(player, userData.accounts, userData.inventory, userData.job, userData.loadout, userData.playerName, userData.lastPosition) + end + ) - xPlayer.getMissingAccounts(function(missingAccounts) + end) - if #missingAccounts > 0 then + Async.series(tasks2, cb) - for i=1, #missingAccounts, 1 do - table.insert(xPlayer.accounts, { - name = missingAccounts[i], - money = 0, - label = Config.AccountLabels[missingAccounts[i]] - }) - end + end) - xPlayer.createAccounts(missingAccounts) - end + -- Run Tasks + Async.parallel(tasks, function(results) - ESX.Players[_source] = xPlayer + local xPlayer = CreateExtendedPlayer(player, userData.accounts, userData.inventory, userData.job, userData.loadout, userData.playerName, userData.lastPosition) - TriggerEvent('esx:playerLoaded', _source) - - TriggerClientEvent('esx:playerLoaded', _source, { - identifier = xPlayer.identifier, - accounts = xPlayer.getAccounts(), - inventory = xPlayer.getInventory(), - job = xPlayer.getJob(), - loadout = xPlayer.getLoadout(), - lastPosition = xPlayer.getLastPosition(), - money = xPlayer.get('money') - }) - - xPlayer.player.displayMoney(xPlayer.get('money')) + xPlayer.getMissingAccounts(function(missingAccounts) - end) + if #missingAccounts > 0 then - end) + for i=1, #missingAccounts, 1 do + table.insert(xPlayer.accounts, { + name = missingAccounts[i], + money = 0, + label = Config.AccountLabels[missingAccounts[i]] + }) + end - end) + xPlayer.createAccounts(missingAccounts) + end + + ESX.Players[_source] = xPlayer + + TriggerEvent('esx:playerLoaded', _source) + + TriggerClientEvent('esx:playerLoaded', _source, { + identifier = xPlayer.identifier, + accounts = xPlayer.getAccounts(), + inventory = xPlayer.getInventory(), + job = xPlayer.getJob(), + loadout = xPlayer.getLoadout(), + lastPosition = xPlayer.getLastPosition(), + money = xPlayer.get('money') + }) + + xPlayer.player.displayMoney(xPlayer.get('money')) + + end) + + end) + + end) end) AddEventHandler('playerDropped', function() - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) + local _source = source + local xPlayer = ESX.GetPlayerFromId(_source) - if xPlayer ~= nil then - - TriggerEvent('esx:playerDropped', _source) - - ESX.SavePlayer(xPlayer, function() - ESX.Players[_source] = nil - ESX.LastPlayerData[_source] = nil - end) + if xPlayer ~= nil then - end + TriggerEvent('esx:playerDropped', _source) + + ESX.SavePlayer(xPlayer, function() + ESX.Players[_source] = nil + ESX.LastPlayerData[_source] = nil + end) + + end end) RegisterServerEvent('esx:updateLoadout') AddEventHandler('esx:updateLoadout', function(loadout) - local xPlayer = ESX.GetPlayerFromId(source) - xPlayer.loadout = loadout + local xPlayer = ESX.GetPlayerFromId(source) + xPlayer.loadout = loadout end) RegisterServerEvent('esx:updateLastPosition') AddEventHandler('esx:updateLastPosition', function(position) - local xPlayer = ESX.GetPlayerFromId(source) - xPlayer.lastPosition = position + local xPlayer = ESX.GetPlayerFromId(source) + xPlayer.lastPosition = position end) RegisterServerEvent('esx:giveInventoryItem') AddEventHandler('esx:giveInventoryItem', function(target, type, itemName, itemCount) - local _source = source + local _source = source - local sourceXPlayer = ESX.GetPlayerFromId(_source) - local targetXPlayer = ESX.GetPlayerFromId(target) - - if type == 'item_standard' then + local sourceXPlayer = ESX.GetPlayerFromId(_source) + local targetXPlayer = ESX.GetPlayerFromId(target) - local sourceItem = sourceXPlayer.getInventoryItem(itemName) - local targetItem = targetXPlayer.getInventoryItem(itemName) + if type == 'item_standard' then - if itemCount > 0 and sourceItem.count >= itemCount then + local sourceItem = sourceXPlayer.getInventoryItem(itemName) + local targetItem = targetXPlayer.getInventoryItem(itemName) - if targetItem.limit ~= -1 and (targetItem.count + itemCount) > targetItem.limit then - TriggerClientEvent('esx:showNotification', target, _U('ex_inv_lim') .. targetXPlayer.name) - else - sourceXPlayer.removeInventoryItem(itemName, itemCount) - targetXPlayer.addInventoryItem (itemName, itemCount) + if itemCount > 0 and sourceItem.count >= itemCount then - TriggerClientEvent('esx:showNotification', _source, _U('yougave') .. ' ~g~x' .. itemCount .. ' ' .. ESX.Items[itemName].label .. _U('to') .. targetXPlayer.name) - TriggerClientEvent('esx:showNotification', target, _U('youreceived') .. ' ~g~x' .. itemCount .. ' ' .. ESX.Items[itemName].label .. _U('by') .. sourceXPlayer.name) - end + if targetItem.limit ~= -1 and (targetItem.count + itemCount) > targetItem.limit then + TriggerClientEvent('esx:showNotification', target, _U('ex_inv_lim') .. targetXPlayer.name) + else + sourceXPlayer.removeInventoryItem(itemName, itemCount) + targetXPlayer.addInventoryItem (itemName, itemCount) - else - TriggerClientEvent('esx:showNotification', target, _U('imp_invalid_quantity')) - end + TriggerClientEvent('esx:showNotification', _source, _U('yougave') .. ' ~g~x' .. itemCount .. ' ' .. ESX.Items[itemName].label .. _U('to') .. targetXPlayer.name) + TriggerClientEvent('esx:showNotification', target, _U('youreceived') .. ' ~g~x' .. itemCount .. ' ' .. ESX.Items[itemName].label .. _U('by') .. sourceXPlayer.name) + end - elseif type == 'item_money' then + else + TriggerClientEvent('esx:showNotification', target, _U('imp_invalid_quantity')) + end - if itemCount > 0 and sourceXPlayer.player.get('money') >= itemCount then + elseif type == 'item_money' then - sourceXPlayer.removeMoney(itemCount) - targetXPlayer.addMoney(itemCount) + if itemCount > 0 and sourceXPlayer.player.get('money') >= itemCount then - TriggerClientEvent('esx:showNotification', _source, _U('yougave') .. ' ~g~$' .. itemCount .. _U('to') .. targetXPlayer.name) - TriggerClientEvent('esx:showNotification', target, _U('youreceived') .. ' ~g~$' .. itemCount .. _U('by') .. sourceXPlayer.name) + sourceXPlayer.removeMoney(itemCount) + targetXPlayer.addMoney(itemCount) - else - TriggerClientEvent('esx:showNotification', target, _U('imp_invalid_amount')) - end + TriggerClientEvent('esx:showNotification', _source, _U('yougave') .. ' ~g~$' .. itemCount .. _U('to') .. targetXPlayer.name) + TriggerClientEvent('esx:showNotification', target, _U('youreceived') .. ' ~g~$' .. itemCount .. _U('by') .. sourceXPlayer.name) - elseif type == 'item_account' then + else + TriggerClientEvent('esx:showNotification', target, _U('imp_invalid_amount')) + end - if itemCount > 0 and sourceXPlayer.getAccount(itemName).money >= itemCount then + elseif type == 'item_account' then - sourceXPlayer.removeAccountMoney(itemName, itemCount) - targetXPlayer.addAccountMoney(itemName, itemCount) + if itemCount > 0 and sourceXPlayer.getAccount(itemName).money >= itemCount then - TriggerClientEvent('esx:showNotification', _source, _U('yougave') .. ' [' .. Config.AccountLabels[itemName] .. '] ~g~$' .. itemCount .. _U('to') .. targetXPlayer.name) - TriggerClientEvent('esx:showNotification', target, _U('youreceived') .. ' [' .. Config.AccountLabels[itemName] .. '] ~g~$' .. itemCount .. _U('by') .. sourceXPlayer.name) + sourceXPlayer.removeAccountMoney(itemName, itemCount) + targetXPlayer.addAccountMoney(itemName, itemCount) - else - TriggerClientEvent('esx:showNotification', target, _U('imp_invalid_amount')) - end + TriggerClientEvent('esx:showNotification', _source, _U('yougave') .. ' [' .. Config.AccountLabels[itemName] .. '] ~g~$' .. itemCount .. _U('to') .. targetXPlayer.name) + TriggerClientEvent('esx:showNotification', target, _U('youreceived') .. ' [' .. Config.AccountLabels[itemName] .. '] ~g~$' .. itemCount .. _U('by') .. sourceXPlayer.name) - elseif type == 'item_weapon' then - - sourceXPlayer.removeWeapon(itemName) - targetXPlayer.addWeapon(itemName, itemCount) + else + TriggerClientEvent('esx:showNotification', target, _U('imp_invalid_amount')) + end - local weaponLabel = itemName + elseif type == 'item_weapon' then - for i=1, #Config.Weapons, 1 do - if Config.Weapons[i].name == itemName then - weaponLabel = Config.Weapons[i].label - break - end - end + sourceXPlayer.removeWeapon(itemName) + targetXPlayer.addWeapon(itemName, itemCount) - TriggerClientEvent('esx:showNotification', _source, _U('yougave') .. ' x1 ~g~' .. weaponLabel .. _U('to') .. targetXPlayer.name) - TriggerClientEvent('esx:showNotification', target, _U('youreceived') .. ' x1 ~g~' .. weaponLabel .. _U('by') .. sourceXPlayer.name) - end + local weaponLabel = itemName + + for i=1, #Config.Weapons, 1 do + if Config.Weapons[i].name == itemName then + weaponLabel = Config.Weapons[i].label + break + end + end + + TriggerClientEvent('esx:showNotification', _source, _U('yougave') .. ' x1 ~g~' .. weaponLabel .. _U('to') .. targetXPlayer.name) + TriggerClientEvent('esx:showNotification', target, _U('youreceived') .. ' x1 ~g~' .. weaponLabel .. _U('by') .. sourceXPlayer.name) + end end) RegisterServerEvent('esx:removeInventoryItem') AddEventHandler('esx:removeInventoryItem', function(type, itemName, itemCount) - - local _source = source - if type == 'item_standard' then + local _source = source - if itemCount == nil or itemCount <= 0 then - TriggerClientEvent('esx:showNotification', _source, _U('imp_invalid_quantity')) - else + if type == 'item_standard' then - local xPlayer = ESX.GetPlayerFromId(source) - local foundItem = nil + if itemCount == nil or itemCount <= 0 then + TriggerClientEvent('esx:showNotification', _source, _U('imp_invalid_quantity')) + else - for i=1, #xPlayer.inventory, 1 do - if xPlayer.inventory[i].name == itemName then - foundItem = xPlayer.inventory[i] - end - end + local xPlayer = ESX.GetPlayerFromId(source) + local foundItem = nil - if itemCount > foundItem.count then - TriggerClientEvent('esx:showNotification', _source, _U('imp_invalid_quantity')) - else - - TriggerClientEvent('esx:showNotification', _source, _U('delete_five_min')) - - SetTimeout(Config.RemoveInventoryItemDelay, function() - - local remainingCount = xPlayer.getInventoryItem(itemName).count - local total = itemCount + for i=1, #xPlayer.inventory, 1 do + if xPlayer.inventory[i].name == itemName then + foundItem = xPlayer.inventory[i] + end + end - if remainingCount < itemCount then - total = remainingCount - end - - if total > 0 then - xPlayer.removeInventoryItem(itemName, total) - ESX.CreatePickup('item_standard', itemName, total, foundItem.label, _source) - TriggerClientEvent('esx:showNotification', _source, _U('threw') .. ' ' .. foundItem.label .. ' x' .. total) - end + if itemCount > foundItem.count then + TriggerClientEvent('esx:showNotification', _source, _U('imp_invalid_quantity')) + else - end) + TriggerClientEvent('esx:showNotification', _source, _U('delete_five_min')) - end + SetTimeout(Config.RemoveInventoryItemDelay, function() - end + local remainingCount = xPlayer.getInventoryItem(itemName).count + local total = itemCount - elseif type == 'item_money' then + if remainingCount < itemCount then + total = remainingCount + end - if itemCount == nil or itemCount <= 0 then - TriggerClientEvent('esx:showNotification', _source, _U('imp_invalid_amount')) - else + if total > 0 then + xPlayer.removeInventoryItem(itemName, total) + ESX.CreatePickup('item_standard', itemName, total, foundItem.label, _source) + TriggerClientEvent('esx:showNotification', _source, _U('threw') .. ' ' .. foundItem.label .. ' x' .. total) + end - local xPlayer = ESX.GetPlayerFromId(source) + end) - if itemCount > xPlayer.player.get('money') then - TriggerClientEvent('esx:showNotification', _source, _U('imp_invalid_amount')) - else - - TriggerClientEvent('esx:showNotification', _source, _U('delete_five_min')) - - SetTimeout(Config.RemoveInventoryItemDelay, function() - - local remainingCount = xPlayer.player.get('money') - local total = itemCount + end - if remainingCount < itemCount then - total = remainingCount - end - - if total > 0 then - xPlayer.removeMoney(total) - ESX.CreatePickup('item_money', 'money', total, 'Cash', _source) - TriggerClientEvent('esx:showNotification', _source, _U('threw') .. ' [Cash] $' .. total) - end + end - end) + elseif type == 'item_money' then - end + if itemCount == nil or itemCount <= 0 then + TriggerClientEvent('esx:showNotification', _source, _U('imp_invalid_amount')) + else - end + local xPlayer = ESX.GetPlayerFromId(source) - elseif type == 'item_account' then + if itemCount > xPlayer.player.get('money') then + TriggerClientEvent('esx:showNotification', _source, _U('imp_invalid_amount')) + else - if itemCount == nil or itemCount <= 0 then - TriggerClientEvent('esx:showNotification', _source, _U('imp_invalid_amount')) - else + TriggerClientEvent('esx:showNotification', _source, _U('delete_five_min')) - local xPlayer = ESX.GetPlayerFromId(source) + SetTimeout(Config.RemoveInventoryItemDelay, function() - if itemCount > xPlayer.getAccount(itemName).money then - TriggerClientEvent('esx:showNotification', _source, _U('imp_invalid_amount')) - else - - TriggerClientEvent('esx:showNotification', _source, _U('delete_five_min')) - - SetTimeout(Config.RemoveInventoryItemDelay, function() - - local remainingCount = xPlayer.getAccount(itemName).money - local total = itemCount + local remainingCount = xPlayer.player.get('money') + local total = itemCount - if remainingCount < itemCount then - total = remainingCount - end - - if total > 0 then - xPlayer.removeAccountMoney(itemName, total) - ESX.CreatePickup('item_account', itemName, total, 'Cash', _source) - TriggerClientEvent('esx:showNotification', _source, _U('threw') .. ' [Cash] $' .. total) - end + if remainingCount < itemCount then + total = remainingCount + end - end) + if total > 0 then + xPlayer.removeMoney(total) + ESX.CreatePickup('item_money', 'money', total, 'Cash', _source) + TriggerClientEvent('esx:showNotification', _source, _U('threw') .. ' [Cash] $' .. total) + end - end + end) - end + end - elseif type == 'item_weapon' then + end - local xPlayer = ESX.GetPlayerFromId(source) - local weaponLabel = itemName - local weaponName = nil - local weaponPickup = nil + elseif type == 'item_account' then - for i=1, #Config.Weapons, 1 do - if Config.Weapons[i].name == itemName then - weaponLabel = Config.Weapons[i].label - weaponName = Config.Weapons[i].name - weaponPickup = 'PICKUP_'..weaponName - break - end - end + if itemCount == nil or itemCount <= 0 then + TriggerClientEvent('esx:showNotification', _source, _U('imp_invalid_amount')) + else - SetTimeout(Config.RemoveInventoryItemDelay, function() - - xPlayer.removeWeapon(itemName) - - if Config.EnableWeaponPickup then - TriggerClientEvent('esx:pickupWeapon', _source, weaponPickup, weaponName) - end - - TriggerClientEvent('esx:showNotification', _source, _U('threw') .. ' x1 ~g~' .. weaponLabel) - - end) + local xPlayer = ESX.GetPlayerFromId(source) - end + if itemCount > xPlayer.getAccount(itemName).money then + TriggerClientEvent('esx:showNotification', _source, _U('imp_invalid_amount')) + else + + TriggerClientEvent('esx:showNotification', _source, _U('delete_five_min')) + + SetTimeout(Config.RemoveInventoryItemDelay, function() + + local remainingCount = xPlayer.getAccount(itemName).money + local total = itemCount + + if remainingCount < itemCount then + total = remainingCount + end + + if total > 0 then + xPlayer.removeAccountMoney(itemName, total) + ESX.CreatePickup('item_account', itemName, total, 'Cash', _source) + TriggerClientEvent('esx:showNotification', _source, _U('threw') .. ' [Cash] $' .. total) + end + + end) + + end + + end + + elseif type == 'item_weapon' then + + local xPlayer = ESX.GetPlayerFromId(source) + local weaponLabel = itemName + local weaponName = nil + local weaponPickup = nil + + for i=1, #Config.Weapons, 1 do + if Config.Weapons[i].name == itemName then + weaponLabel = Config.Weapons[i].label + weaponName = Config.Weapons[i].name + weaponPickup = 'PICKUP_'..weaponName + break + end + end + + SetTimeout(Config.RemoveInventoryItemDelay, function() + + xPlayer.removeWeapon(itemName) + + if Config.EnableWeaponPickup then + TriggerClientEvent('esx:pickupWeapon', _source, weaponPickup, weaponName) + end + + TriggerClientEvent('esx:showNotification', _source, _U('threw') .. ' x1 ~g~' .. weaponLabel) + + end) + + end end) RegisterServerEvent('esx:useItem') AddEventHandler('esx:useItem', function(itemName) - local xPlayer = ESX.GetPlayerFromId(source) - local count = xPlayer.getInventoryItem(itemName).count + local xPlayer = ESX.GetPlayerFromId(source) + local count = xPlayer.getInventoryItem(itemName).count - if count > 0 then - ESX.UseItem(source, itemName) - else - TriggerClientEvent('esx:showNotification', xPlayer.source, _U('act_imp')) - end + if count > 0 then + ESX.UseItem(source, itemName) + else + TriggerClientEvent('esx:showNotification', xPlayer.source, _U('act_imp')) + end end) RegisterServerEvent('esx:onPickup') AddEventHandler('esx:onPickup', function(id) - local pickup = ESX.Pickups[id] - local xPlayer = ESX.GetPlayerFromId(source) + local pickup = ESX.Pickups[id] + local xPlayer = ESX.GetPlayerFromId(source) - if pickup.type == 'item_standard' then - xPlayer.addInventoryItem(pickup.name, pickup.count) - elseif pickup.type == 'item_money' then - xPlayer.addMoney(pickup.count) - elseif pickup.type == 'item_account' then - xPlayer.addAccountMoney(pickup.name, pickup.count) - end + if pickup.type == 'item_standard' then + xPlayer.addInventoryItem(pickup.name, pickup.count) + elseif pickup.type == 'item_money' then + xPlayer.addMoney(pickup.count) + elseif pickup.type == 'item_account' then + xPlayer.addAccountMoney(pickup.name, pickup.count) + end - TriggerClientEvent('esx:removePickup', -1, id) + TriggerClientEvent('esx:removePickup', -1, id) end) ESX.RegisterServerCallback('esx:getPlayerData', function(source, cb) - local xPlayer = ESX.GetPlayerFromId(source) + local xPlayer = ESX.GetPlayerFromId(source) - cb({ - identifier = xPlayer.identifier, - accounts = xPlayer.getAccounts(), - inventory = xPlayer.getInventory(), - job = xPlayer.getJob(), - loadout = xPlayer.getLoadout(), - lastPosition = xPlayer.getLastPosition(), - money = xPlayer.get('money') - }) + cb({ + identifier = xPlayer.identifier, + accounts = xPlayer.getAccounts(), + inventory = xPlayer.getInventory(), + job = xPlayer.getJob(), + loadout = xPlayer.getLoadout(), + lastPosition = xPlayer.getLastPosition(), + money = xPlayer.get('money') + }) end) ESX.RegisterServerCallback('esx:getOtherPlayerData', function(source, cb, target) - local xPlayer = ESX.GetPlayerFromId(target) + local xPlayer = ESX.GetPlayerFromId(target) - cb({ - identifier = xPlayer.identifier, - accounts = xPlayer.getAccounts(), - inventory = xPlayer.getInventory(), - job = xPlayer.getJob(), - loadout = xPlayer.getLoadout(), - lastPosition = xPlayer.getLastPosition(), - money = xPlayer.get('money') - }) + cb({ + identifier = xPlayer.identifier, + accounts = xPlayer.getAccounts(), + inventory = xPlayer.getInventory(), + job = xPlayer.getJob(), + loadout = xPlayer.getLoadout(), + lastPosition = xPlayer.getLastPosition(), + money = xPlayer.get('money') + }) end) TriggerEvent("es:addGroup", "jobmaster", "user", function(group) end) ESX.StartDBSync() -ESX.StartPayCheck() \ No newline at end of file +ESX.StartPayCheck() diff --git a/resources/[essential]/es_extended/server/paycheck.lua b/resources/[essential]/es_extended/server/paycheck.lua index f68818a4..69f3de3e 100644 --- a/resources/[essential]/es_extended/server/paycheck.lua +++ b/resources/[essential]/es_extended/server/paycheck.lua @@ -1,24 +1,24 @@ ESX.StartPayCheck = function() - function payCheck() + function payCheck() - local xPlayers = ESX.GetPlayers() + local xPlayers = ESX.GetPlayers() - for i=1, #xPlayers, 1 do + for i=1, #xPlayers, 1 do - local xPlayer = ESX.GetPlayerFromId(xPlayers[i]) + local xPlayer = ESX.GetPlayerFromId(xPlayers[i]) - if xPlayer.job.grade_salary > 0 then - xPlayer.addMoney(xPlayer.job.grade_salary) - TriggerClientEvent('esx:showNotification', xPlayer.source, _U('rec_salary') .. '~g~$' .. xPlayer.job.grade_salary) - end + if xPlayer.job.grade_salary > 0 then + xPlayer.addMoney(xPlayer.job.grade_salary) + TriggerClientEvent('esx:showNotification', xPlayer.source, _U('rec_salary') .. '~g~$' .. xPlayer.job.grade_salary) + end - end + end - SetTimeout(Config.PaycheckInterval, payCheck) + SetTimeout(Config.PaycheckInterval, payCheck) - end + end - SetTimeout(Config.PaycheckInterval, payCheck) + SetTimeout(Config.PaycheckInterval, payCheck) -end \ No newline at end of file +end