diff --git a/client/functions.lua b/client/functions.lua
index f15797ed..d801c1b5 100644
--- a/client/functions.lua
+++ b/client/functions.lua
@@ -865,20 +865,6 @@ ESX.ShowInventory = function()
local playerPed = PlayerPedId()
local elements, currentWeight = {}, 0
- if ESX.PlayerData.money > 0 then
- local formattedMoney = _U('locale_currency', ESX.Math.GroupDigits(ESX.PlayerData.money))
-
- table.insert(elements, {
- label = ('%s: %s'):format(_U('cash'), formattedMoney),
- count = ESX.PlayerData.money,
- type = 'item_money',
- value = 'money',
- usable = false,
- rare = false,
- canRemove = true
- })
- end
-
for k,v in pairs(ESX.PlayerData.accounts) do
if v.money > 0 then
local formattedMoney = _U('locale_currency', ESX.Math.GroupDigits(v.money))
diff --git a/client/main.lua b/client/main.lua
index 4905e97c..caccc586 100644
--- a/client/main.lua
+++ b/client/main.lua
@@ -1,40 +1,29 @@
local isLoadoutLoaded, isPaused, isDead, isFirstSpawn, pickups = false, false, false, true, {}
RegisterNetEvent('esx:playerLoaded')
-AddEventHandler('esx:playerLoaded', function(xPlayer)
+AddEventHandler('esx:playerLoaded', function(playerData)
ESX.PlayerLoaded = true
- ESX.PlayerData = xPlayer
+ ESX.PlayerData = playerData
if Config.EnableHud then
- for k,v in ipairs(xPlayer.accounts) do
+ for k,v in ipairs(playerData.accounts) do
local accountTpl = '

{{money}}
'
- ESX.UI.HUD.RegisterElement('account_' .. v.name, k - 1, 0, accountTpl, {
- money = 0
- })
-
- ESX.UI.HUD.UpdateElement('account_' .. v.name, {
+ ESX.UI.HUD.RegisterElement('account_' .. v.name, k, 0, accountTpl, {
money = ESX.Math.GroupDigits(v.money)
})
end
local jobTpl = '{{job_label}} - {{grade_label}}
'
- if xPlayer.job.grade_label == '' then
+ if playerData.job.grade_label == '' or playerData.job.grade_label == playerData.job.label then
jobTpl = '{{job_label}}
'
end
- ESX.UI.HUD.RegisterElement('job', #xPlayer.accounts, 0, jobTpl, {
- job_label = '',
- grade_label = ''
+ ESX.UI.HUD.RegisterElement('job', #playerData.accounts, 0, jobTpl, {
+ job_label = playerData.job.label,
+ grade_label = playerData.job.grade_label
})
-
- ESX.UI.HUD.UpdateElement('job', {
- job_label = xPlayer.job.label,
- grade_label = xPlayer.job.grade_label
- })
- else
- TriggerEvent('es:setMoneyDisplay', 0.0)
end
end)
@@ -44,6 +33,10 @@ AddEventHandler('esx:setMaxWeight', function(newMaxWeight)
end)
AddEventHandler('playerSpawned', function()
+ if isFirstSpawn then
+ TriggerServerEvent('esx:playerJoined')
+ end
+
while not ESX.PlayerLoaded do
Citizen.Wait(10)
end
@@ -120,11 +113,6 @@ AddEventHandler('esx:setAccountMoney', function(account)
end
end)
-RegisterNetEvent('es:activateMoney')
-AddEventHandler('es:activateMoney', function(money)
- ESX.PlayerData.money = money
-end)
-
RegisterNetEvent('esx:addInventoryItem')
AddEventHandler('esx:addInventoryItem', function(item, count, showNotification)
for k,v in ipairs(ESX.PlayerData.inventory) do
@@ -394,11 +382,9 @@ if Config.EnableHud then
if IsPauseMenuActive() and not isPaused then
isPaused = true
- TriggerEvent('es:setMoneyDisplay', 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)
end
end
diff --git a/config.lua b/config.lua
index d3bf0edb..be3e5171 100644
--- a/config.lua
+++ b/config.lua
@@ -1,8 +1,11 @@
-Config = {}
-Config.Locale = 'fr'
+Config = {}
+Config.Locale = 'fr'
-Config.Accounts = {'bank', 'black_money'}
-Config.AccountLabels = {bank = _U('bank'), black_money = _U('black_money')}
+Config.Accounts = {
+ bank = _U('account_bank'),
+ black_money = _U('account_black_money'),
+ money = _U('account_money')
+}
Config.EnableSocietyPayouts = false -- pay from the society account that the player is employed at? Requirement: esx_society
Config.DisableWantedLevel = true
diff --git a/es_extended.sql b/es_extended.sql
index dce1fe4d..111cef1f 100644
--- a/es_extended.sql
+++ b/es_extended.sql
@@ -1,13 +1,16 @@
USE `essentialmode`;
-ALTER TABLE `users`
- ADD COLUMN `skin` LONGTEXT NULL,
- ADD COLUMN `job` VARCHAR(50) 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 `inventory` LONGTEXT NULL AFTER `loadout`,
- ADD COLUMN `position` VARCHAR(53) NULL DEFAULT '{"x":-269.4,"y":-955.3,"z":31.2,"heading":205.8}' AFTER `inventory`
-;
+CREATE TABLE `users` (
+ `identifier` VARCHAR(40) NOT NULL,
+ `group` VARCHAR(50) NULL DEFAULT 'user',
+ `job` VARCHAR(20) NULL DEFAULT 'unemployed',
+ `job_grade` INT(11) NULL DEFAULT 0,
+ `inventory` LONGTEXT NULL DEFAULT NULL,
+ `loadout` LONGTEXT NULL DEFAULT NULL,
+ `position` VARCHAR(53) NULL DEFAULT '{"x":-269.4,"y":-955.3,"z":31.2,"heading":205.8}',
+
+ PRIMARY KEY (`identifier`)
+);
CREATE TABLE `items` (
`name` VARCHAR(50) NOT NULL,
@@ -45,7 +48,7 @@ INSERT INTO `jobs` VALUES ('unemployed','Unemployed');
CREATE TABLE `user_accounts` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
- `identifier` VARCHAR(22) NOT NULL,
+ `identifier` VARCHAR(40) NOT NULL,
`name` VARCHAR(50) NOT NULL,
`money` INT(11) NOT NULL DEFAULT '0',
diff --git a/fxmanifest.lua b/fxmanifest.lua
index a4be3e72..f40e04a9 100644
--- a/fxmanifest.lua
+++ b/fxmanifest.lua
@@ -82,7 +82,8 @@ files {
'html/fonts/bankgothic.ttf',
'html/img/accounts/bank.png',
- 'html/img/accounts/black_money.png'
+ 'html/img/accounts/black_money.png',
+ 'html/img/accounts/money.png',
}
exports {
@@ -95,7 +96,5 @@ server_exports {
dependencies {
'mysql-async',
- 'essentialmode',
- 'esplugin_mysql',
'async'
}
diff --git a/html/img/accounts/money.png b/html/img/accounts/money.png
new file mode 100644
index 00000000..e05c91b0
Binary files /dev/null and b/html/img/accounts/money.png differ
diff --git a/locales/br.lua b/locales/br.lua
index 86fb98d2..f8573d2d 100644
--- a/locales/br.lua
+++ b/locales/br.lua
@@ -1,6 +1,5 @@
Locales['br'] = {
-- Inventory
- ['cash'] = 'dinheiro',
['inventory'] = 'inventário %s / %s',
['use'] = 'usar',
['give'] = 'dar',
@@ -23,8 +22,6 @@ Locales['br'] = {
['received_weapon_withammo'] = 'você recebeu ~b~%s~s~ com ~o~%sx %s~s~ de ~b~%s~s~',
['received_weapon_hasalready'] = '~b~%s~s~ tentou lhe dar uma ~y~%s~s~, mas você já tem um(a)',
['received_weapon_noweapon'] = '~b~%s~s~ tentou lhe dar munição para ~y~%s~s~, mas você não tem um(a)',
- ['gave_money'] = 'voce deu ~g~$%s~s~ para ~y~%s~s~',
- ['received_money'] = 'voce recebeu ~g~$%s~s~ de ~b~%s~s~',
['gave_account_money'] = 'voce deu ~g~$%s~s~ (%s) para ~y~%s~s~',
['received_account_money'] = 'voce recebeu ~g~$%s~s~ (%s) de ~b~%s~s~',
['amount_invalid'] = 'quantidade inválida',
@@ -33,7 +30,6 @@ Locales['br'] = {
['imp_invalid_quantity'] = 'ação impossível, quantidade inválida',
['imp_invalid_amount'] = 'ação impossível, valor invalido',
['threw_standard'] = 'você jogou ~y~%sx~s~ ~b~%s~s~',
- ['threw_money'] = 'você jogou ~g~$%s~s~ ~b~cash~s~',
['threw_account'] = 'você jogou ~g~$%s~s~ ~b~%s~s~',
['threw_weapon'] = 'você jogou ~b~%s~s~',
['threw_weapon_ammo'] = 'você jogou ~b~%s~s~ com ~o~%sx %s~s~',
@@ -50,7 +46,9 @@ Locales['br'] = {
['company_nomoney'] = 'a empresa em que voce esta empregado esta muito pobre para pagar seu salário',
['received_paycheck'] = 'recebeu dinheiro',
['bank'] = 'banco',
- ['black_money'] = 'dinheiro sujo',
+ ['account_bank'] = 'bank',
+ ['account_black_money'] = 'dirty Money',
+ ['account_money'] = 'cash',
['act_imp'] = 'ação impossível',
['in_vehicle'] = 'voce não pode dar nada para alguem no veículo',
@@ -75,7 +73,6 @@ Locales['br'] = {
['chat_clear_all'] = 'limpar o chat para todos',
['command_clearinventory'] = 'remover todos os itens do inventário',
['command_clearloadout'] = 'remova todas as armas do carregamento',
- ['command_playerid_param'] = 'especifique playerId ou deixe em branco para si mesmo',
-- Locale settings
['locale_digit_grouping_symbol'] = ' ',
diff --git a/locales/cs.lua b/locales/cs.lua
index 5c1283b8..de60f089 100644
--- a/locales/cs.lua
+++ b/locales/cs.lua
@@ -1,6 +1,5 @@
Locales['cs'] = {
-- Inventory
- ['cash'] = 'hotovost',
['inventory'] = 'inventář %s / %s',
['use'] = 'použít',
['give'] = 'dát',
@@ -23,8 +22,6 @@ Locales['cs'] = {
['received_weapon_withammo'] = 'you received ~b~%s~s~ with ~o~%sx %s~s~ from ~b~%s~s~',
['received_weapon_hasalready'] = '~b~%s~s~ attempted to give you an ~y~%s~s~, but you already have one',
['received_weapon_noweapon'] = '~b~%s~s~ attempted to give you ammo for an ~y~%s~s~, but you dont have one',
- ['gave_money'] = 'dali jste ~g~$%s~s~ ~y~%s~s~',
- ['received_money'] = 'obdrželi jste ~g~$%s~s~ od ~b~%s~s~',
['gave_account_money'] = 'dali jste ~g~$%s~s~ (%s) ~y~%s~s~',
['received_account_money'] = 'obdrželi jste ~g~$%s~s~ (%s) od ~b~%s~s~',
['amount_invalid'] = 'neplatné množství',
@@ -33,7 +30,6 @@ Locales['cs'] = {
['imp_invalid_quantity'] = 'akce není možná, neplatný počet',
['imp_invalid_amount'] = 'akce není možná, neplatné množství',
['threw_standard'] = 'you threw ~y~%sx~s~ ~b~%s~s~',
- ['threw_money'] = 'you threw ~g~$%s~s~ ~b~cash~s~',
['threw_account'] = 'you threw ~g~$%s~s~ ~b~%s~s~',
['threw_weapon'] = 'you threw ~b~%s~s~',
['threw_weapon_ammo'] = 'you threw ~b~%s~s~ with ~o~%sx %s~s~',
@@ -51,7 +47,9 @@ Locales['cs'] = {
['company_nomoney'] = 'společnost u které jste zaměstananí nemá peníze na váš plat',
['received_paycheck'] = 'obdržena výplata',
['bank'] = 'bankovní účet',
- ['black_money'] = 'špinavé peníze',
+ ['account_bank'] = 'bank',
+ ['account_black_money'] = 'dirty Money',
+ ['account_money'] = 'cash',
['act_imp'] = 'akce není možná',
['in_vehicle'] = 'nemůže nic dát osobě ve vozidle',
@@ -76,7 +74,6 @@ Locales['cs'] = {
['chat_clear_all'] = 'vyčistit chat pro všechny',
['command_clearinventory'] = 'clear all items from inventory',
['command_clearloadout'] = 'remove all weapons from loadout',
- ['command_playerid_param'] = 'specify playerId or leave blank for yourself',
-- Locale settings
['locale_digit_grouping_symbol'] = ' ',
diff --git a/locales/de.lua b/locales/de.lua
index 44f23ed0..61f77920 100644
--- a/locales/de.lua
+++ b/locales/de.lua
@@ -1,6 +1,5 @@
Locales['de'] = {
-- Inventory
- ['cash'] = 'bargeld',
['inventory'] = 'inventar %s / %s',
['use'] = 'benutzen',
['give'] = 'geben',
@@ -23,8 +22,6 @@ Locales['de'] = {
['received_weapon_withammo'] = 'du erhälst ~b~%s~s~ mit ~o~%sx %s~s~ von ~b~%s~s~',
['received_weapon_hasalready'] = '~b~%s~s~ hat versucht dir eine(n) ~y~%s~s~ zu geben, aber du hast bereits eine(n)',
['received_weapon_noweapon'] = '~b~%s~s~ attempted to give you ammo for an ~y~%s~s~, but you dont have one',
- ['gave_money'] = 'du gibst ~g~$%s~s~ an ~y~%s~s~',
- ['received_money'] = 'du erhälst ~g~$%s~s~ von ~b~%s~s~',
['gave_account_money'] = 'du gibst ~g~$%s~s~ (%s) an ~y~%s~s~',
['received_account_money'] = 'du empfängst ~g~$%s~s~ (%s) von ~b~%s~s~',
['amount_invalid'] = 'ungültiger Betrag',
@@ -33,7 +30,6 @@ Locales['de'] = {
['imp_invalid_quantity'] = 'aktion nicht möglich, ungültige Anzahl',
['imp_invalid_amount'] = 'aktion nicht möglich, ungültiger Betrag',
['threw_standard'] = 'you threw ~y~%sx~s~ ~b~%s~s~',
- ['threw_money'] = 'you threw ~g~$%s~s~ ~b~cash~s~',
['threw_account'] = 'you threw ~g~$%s~s~ ~b~%s~s~',
['threw_weapon'] = 'you threw ~b~%s~s~',
['threw_weapon_ammo'] = 'you threw ~b~%s~s~ with ~o~%sx %s~s~',
@@ -50,7 +46,9 @@ Locales['de'] = {
['company_nomoney'] = 'die Firma in der du angestellt bist, ist zu arm um dein Gehalt zu zahlen',
['received_paycheck'] = 'erhaltener Gehaltsscheck',
['bank'] = 'bank',
- ['black_money'] = 'schwarzgeld',
+ ['account_bank'] = 'bank',
+ ['account_black_money'] = 'dirty Money',
+ ['account_money'] = 'cash',
['act_imp'] = 'Aktion nicht möglich',
['in_vehicle'] = 'you can\'t give anything to someone in a vehicle',
@@ -75,7 +73,6 @@ Locales['de'] = {
['chat_clear_all'] = 'clear the chat for everyone',
['command_clearinventory'] = 'clear all items from inventory',
['command_clearloadout'] = 'remove all weapons from loadout',
- ['command_playerid_param'] = 'specify playerId or leave blank for yourself',
-- Locale settings
['locale_digit_grouping_symbol'] = ' ',
diff --git a/locales/en.lua b/locales/en.lua
index 73ad1b84..44c4c680 100644
--- a/locales/en.lua
+++ b/locales/en.lua
@@ -1,6 +1,5 @@
Locales['en'] = {
-- Inventory
- ['cash'] = 'cash',
['inventory'] = 'inventory %s / %s',
['use'] = 'use',
['give'] = 'give',
@@ -23,8 +22,6 @@ Locales['en'] = {
['received_weapon_withammo'] = 'you received ~b~%s~s~ with ~o~%sx %s~s~ from ~b~%s~s~',
['received_weapon_hasalready'] = '~b~%s~s~ attempted to give you an ~y~%s~s~, but you already have one',
['received_weapon_noweapon'] = '~b~%s~s~ attempted to give you ammo for an ~y~%s~s~, but you dont have one',
- ['gave_money'] = 'you gave ~g~$%s~s~ to ~y~%s~s~',
- ['received_money'] = 'you received ~g~$%s~s~ from ~b~%s~s~',
['gave_account_money'] = 'you gave ~g~$%s~s~ (%s) to ~y~%s~s~',
['received_account_money'] = 'you received ~g~$%s~s~ (%s) from ~b~%s~s~',
['amount_invalid'] = 'invalid amount',
@@ -33,7 +30,6 @@ Locales['en'] = {
['imp_invalid_quantity'] = 'action impossible, invalid quantity',
['imp_invalid_amount'] = 'action impossible, invalid amount',
['threw_standard'] = 'you threw ~y~%sx~s~ ~b~%s~s~',
- ['threw_money'] = 'you threw ~g~$%s~s~ ~b~cash~s~',
['threw_account'] = 'you threw ~g~$%s~s~ ~b~%s~s~',
['threw_weapon'] = 'you threw ~b~%s~s~',
['threw_weapon_ammo'] = 'you threw ~b~%s~s~ with ~o~%sx %s~s~',
@@ -50,7 +46,9 @@ Locales['en'] = {
['company_nomoney'] = 'the company you\'re employeed at is too poor to pay out your salary',
['received_paycheck'] = 'received paycheck',
['bank'] = 'maze Bank',
- ['black_money'] = 'dirty Money',
+ ['account_bank'] = 'bank',
+ ['account_black_money'] = 'dirty Money',
+ ['account_money'] = 'cash',
['act_imp'] = 'action impossible',
['in_vehicle'] = 'you can\'t give anything to someone in a vehicle',
@@ -75,7 +73,6 @@ Locales['en'] = {
['chat_clear_all'] = 'clear the chat for everyone',
['command_clearinventory'] = 'clear all items from inventory',
['command_clearloadout'] = 'remove all weapons from loadout',
- ['command_playerid_param'] = 'specify playerId or leave blank for yourself',
-- Locale settings
['locale_digit_grouping_symbol'] = ',',
diff --git a/locales/fi.lua b/locales/fi.lua
index e996ad77..6e113511 100644
--- a/locales/fi.lua
+++ b/locales/fi.lua
@@ -1,6 +1,5 @@
Locales['fi'] = {
-- Inventory
- ['cash'] = 'käteinen',
['inventory'] = 'reppu %s / %s',
['use'] = 'käytä',
['give'] = 'anna',
@@ -23,8 +22,6 @@ Locales['fi'] = {
['received_weapon_withammo'] = 'you received ~y~1x~s~ ~b~%s~s~ with ~o~%sx %s~s~ from ~b~%s~s~',
['received_weapon_hasalready'] = '~b~%s~s~ attempted to give you an ~y~%s~s~, but you already have one',
['received_weapon_noweapon'] = '~b~%s~s~ attempted to give you ammo for an ~y~%s~s~, but you dont have one',
- ['gave_money'] = 'sinä annoit ~g~$%s~s~ henkilölle ~y~%s~s~',
- ['received_money'] = 'sinä sait ~g~$%s~s~ henkilöltä ~b~%s~s~',
['gave_account_money'] = 'sinä annoit ~g~$%s~s~ (%s) henkilölle ~y~%s~s~',
['received_account_money'] = 'sinä sait ~g~$%s~s~ (%s) henkilöltä ~b~%s~s~',
['amount_invalid'] = 'virheellinen määrä',
@@ -33,7 +30,6 @@ Locales['fi'] = {
['imp_invalid_quantity'] = 'toiminto mahdoton, virheellinen määrä',
['imp_invalid_amount'] = 'toiminto mahdoton, virhellinen summa',
['threw_standard'] = 'you threw ~y~%sx~s~ ~b~%s~s~',
- ['threw_money'] = 'you threw ~g~$%s~s~ ~b~cash~s~',
['threw_account'] = 'you threw ~g~$%s~s~ ~b~%s~s~',
['threw_weapon'] = 'you threw ~y~1x~s~ ~b~%s~s~',
['threw_weapon_ammo'] = 'you threw ~y~1x~s~ ~b~%s~s~ with ~o~%sx %s~s~',
@@ -50,7 +46,9 @@ Locales['fi'] = {
['company_nomoney'] = 'yritys jolle teet töitä on köyhä eikä voi maksaa palkkaasi',
['received_paycheck'] = 'sait palkan',
['bank'] = 'pankki',
- ['black_money'] = 'likainen Raha',
+ ['account_bank'] = 'bank',
+ ['account_black_money'] = 'dirty Money',
+ ['account_money'] = 'cash',
['act_imp'] = 'toiminto mahdoton',
['in_vehicle'] = 'et voi antaa ajoneuvossa olevalle mitään',
@@ -75,7 +73,6 @@ Locales['fi'] = {
['chat_clear_all'] = 'tyhjennä chatti kaikilta',
['command_clearinventory'] = 'clear all items from inventory',
['command_clearloadout'] = 'remove all weapons from loadout',
- ['command_playerid_param'] = 'specify playerId or leave blank for yourself',
-- Locale settings
['locale_digit_grouping_symbol'] = ' ',
diff --git a/locales/fr.lua b/locales/fr.lua
index 3483566a..0295f845 100644
--- a/locales/fr.lua
+++ b/locales/fr.lua
@@ -1,6 +1,5 @@
Locales['fr'] = {
-- Inventory
- ['cash'] = 'espèces',
['inventory'] = 'inventaire %s / %s',
['use'] = 'utiliser',
['give'] = 'donner',
@@ -23,8 +22,6 @@ Locales['fr'] = {
['received_weapon_withammo'] = 'vous avez reçu ~y~1x~s~ ~b~%s~s~ avec ~o~%sx %s~s~ de ~b~%s~s~',
['received_weapon_hasalready'] = '~b~%s~s~ a tenté de vous donner ~y~%s~s~, mais vous en aviez déjà un exemplaire',
['received_weapon_noweapon'] = '~b~%s~s~ tente de vous donner des munitions pour ~y~%s~s~, mais vous n\'en avez pas',
- ['gave_money'] = 'vous avez donné ~g~$%s~s~ à ~y~%s~s~',
- ['received_money'] = 'vous avez reçu ~g~$%s~s~ par ~b~%s~s~',
['gave_account_money'] = 'vous avez donné ~g~$%s~s~ (%s) à ~y~%s~s~',
['received_account_money'] = 'vous avez reçu ~g~$%s~s~ (%s) par ~b~%s~s~',
['amount_invalid'] = 'montant invalide',
@@ -33,7 +30,6 @@ Locales['fr'] = {
['imp_invalid_quantity'] = 'action impossible, ~r~quantité invalide',
['imp_invalid_amount'] = 'action impossible, ~r~montant invalide',
['threw_standard'] = 'vous avez jeté ~y~%sx~s~ ~b~%s~s~',
- ['threw_money'] = 'vous avez jeté ~g~$%s~s~ ~b~cash~s~',
['threw_account'] = 'vous avez jeté ~g~$%s~s~ ~b~%s~s~',
['threw_weapon'] = 'vous avez jeté ~y~1x~s~ ~b~%s~s~',
['threw_weapon_ammo'] = 'vous avez jeté ~y~1x~s~ ~b~%s~s~ avec ~o~%sx %s~s~',
@@ -50,7 +46,9 @@ Locales['fr'] = {
['company_nomoney'] = 'votre entreprise n\'a plus d\'argent pour vous payer!',
['received_paycheck'] = 'paiement reçu',
['bank'] = 'banque',
- ['black_money'] = 'argent sale',
+ ['account_bank'] = 'bank',
+ ['account_black_money'] = 'dirty Money',
+ ['account_money'] = 'cash',
['act_imp'] = 'action impossible',
['in_vehicle'] = 'Vous ne pouvez rien donner à quelqu\'un dans un véhicule',
@@ -75,7 +73,6 @@ Locales['fr'] = {
['chat_clear_all'] = 'vider le chat pour tous le monde',
['command_clearinventory'] = 'effacer tout les items de l\'inventaire',
['command_clearloadout'] = 'retirer toutes les armes de l\'équipement',
- ['command_playerid_param'] = 'spécifiez un playerid ou laissez vide pour vous-même',
-- Locale settings
['locale_digit_grouping_symbol'] = ' ',
diff --git a/locales/pl.lua b/locales/pl.lua
index 4cdfe07e..a691437a 100644
--- a/locales/pl.lua
+++ b/locales/pl.lua
@@ -1,6 +1,5 @@
Locales['pl'] = {
-- Inventory
- ['cash'] = 'gotówka',
['inventory'] = 'ekwipunek %s / %s',
['use'] = 'użyj',
['give'] = 'daj',
@@ -23,8 +22,6 @@ Locales['pl'] = {
['received_weapon_withammo'] = 'otrzymałeś/aś ~b~%s~s~ z ~o~%sx %s~s~ od ~b~%s~s~',
['received_weapon_hasalready'] = '~b~%s~s~ próbował/a przekazać ci ~y~%s~s~, lecz już posiadasz jedno',
['received_weapon_noweapon'] = '~b~%s~s~ próbował/a przekazać ci amunicje do ~y~%s~s~, lecz nie posiadasz tej broni',
- ['gave_money'] = 'dajesz ~g~%s$~s~ dla ~y~%s~s~',
- ['received_money'] = 'otrzymujesz ~g~%s$~s~ od ~b~%s~s~',
['gave_account_money'] = 'dajesz ~g~%s$~s~ (%s) dla ~y~%s~s~',
['received_account_money'] = 'otrzymujesz ~g~%s$~s~ (%s) od ~b~%s~s~',
['amount_invalid'] = 'nieprawidłowa ilość',
@@ -33,7 +30,6 @@ Locales['pl'] = {
['imp_invalid_quantity'] = 'akcja jest niemożliwa, nieprawidłowa ilość',
['imp_invalid_amount'] = 'akcja jest niemożliwa, nieprawidłowa kwota',
['threw_standard'] = 'wyrzuciłeś/aś ~y~%sx~s~ ~b~%s~s~',
- ['threw_money'] = 'wyrzuciłeś/aś ~g~$%s~s~ ~b~gotówki~s~',
['threw_account'] = 'wyrzuciłeś/aś ~g~$%s~s~ ~b~%s~s~',
['threw_weapon'] = 'wyrzuciłeś/aś ~b~%s~s~',
['threw_weapon_ammo'] = 'wyrzuciłeś/aś ~b~%s~s~ z ~o~%sx %s~s~',
@@ -44,14 +40,16 @@ Locales['pl'] = {
-- Key mapping
['keymap_showinventory'] = 'show Inventory',
-
-- Salary related
['received_salary'] = 'otrzymałeś wynagrodzenie: ~g~%s$~s~',
['received_help'] = 'otrzymałem zapomogę: ~g~$%s~s~',
['company_nomoney'] = 'firma, w której pracujesz, jest zbyt biedna, by wypłacić twoją pensję',
['received_paycheck'] = 'otrzymana wypłata',
['bank'] = 'bank',
- ['black_money'] = 'brudne pieniądze',
+ ['account_bank'] = 'bank',
+ ['account_black_money'] = 'dirty Money',
+ ['account_money'] = 'cash',
+
['act_imp'] = 'działanie niemożliwe',
['in_vehicle'] = 'nie możesz przekazywać przedmiotów w pojeździe',
@@ -75,7 +73,6 @@ Locales['pl'] = {
['chat_clear_all'] = 'wyczyść czat dla wszystkich',
['command_clearinventory'] = 'usuń wszystkie przedmioty z ekwipunku',
['command_clearloadout'] = 'usuń wszystkie bronie z wyposażenia',
- ['command_playerid_param'] = 'id gracza lub zostaw puste dla siebie',
-- Locale settings
['locale_digit_grouping_symbol'] = ' ',
diff --git a/locales/sv.lua b/locales/sv.lua
index 1f23cbc4..8be097c6 100644
--- a/locales/sv.lua
+++ b/locales/sv.lua
@@ -1,6 +1,5 @@
Locales['sv'] = {
-- Inventory
- ['cash'] = 'kontanter',
['inventory'] = 'mitt förråd %s / %s',
['use'] = 'använd',
['give'] = 'ge',
@@ -23,8 +22,6 @@ Locales['sv'] = {
['received_weapon_withammo'] = 'du tog emot ~b~%s~s~ med ~o~%sx %s~s~ från ~b~%s~s~',
['received_weapon_hasalready'] = '~b~%s~s~ försökte ge dig en ~y~%s~s~, men det vapnet har du redan',
['received_weapon_noweapon'] = '~b~%s~s~ försökte ge dig ammunition för ett ~y~%s~s~, men du har inget sådant vapen',
- ['gave_money'] = 'du gav ~g~%s SEK~s~ till ~y~%s~s~',
- ['received_money'] = 'du tog emot ~g~%s SEK~s~ från ~b~%s~s~',
['gave_account_money'] = 'du gav ~g~%s SEK~s~ (%s) till ~y~%s~s~',
['received_account_money'] = 'du tog emot ~g~%s SEK~s~ (%s) från ~b~%s~s~',
['amount_invalid'] = 'ogiltig mängd',
@@ -33,7 +30,6 @@ Locales['sv'] = {
['imp_invalid_quantity'] = 'åtgärd omöjlig, ogiltig mängd',
['imp_invalid_amount'] = 'åtgärd omöjlig, ogiltig belopp',
['threw_standard'] = 'du kastade ~y~%sx~s~ ~b~%s~s~',
- ['threw_money'] = 'du kastade ~g~%s SEK~s~ ~b~kontanter~s~',
['threw_account'] = 'du kastade ~g~%s SEK~s~ ~b~%s~s~',
['threw_weapon'] = 'du kastade ~b~%s~s~',
['threw_weapon_ammo'] = 'du kastade ~b~%s~s~ med ~o~%sx %s~s~',
@@ -50,7 +46,9 @@ Locales['sv'] = {
['company_nomoney'] = 'företaget du är anställt hos har inte råd att betala ut din lön',
['received_paycheck'] = 'mottagit lön',
['bank'] = 'bank',
- ['black_money'] = 'svarta pengar',
+ ['account_bank'] = 'bank',
+ ['account_black_money'] = 'svarta pengar',
+ ['account_money'] = 'kontakter',
['act_imp'] = 'åtgärd omöjlig',
['in_vehicle'] = 'du kan inte ge saker till en som sitter i ett fordon!',
@@ -59,7 +57,7 @@ Locales['sv'] = {
['setjob'] = 'tilldela ett jobb till en spelare',
['id_param'] = 'spelarens ID',
['setjob_param2'] = 'det jobb du vill tilldela',
- ['setjob_param3'] = 'job level',
+ ['setjob_param3'] = 'job nivå',
['spawn_car'] = 'spawna ett fordon',
['spawn_car_param'] = 'namn på fordon',
['delete_vehicle'] = 'ta bort fordon',
@@ -68,14 +66,13 @@ Locales['sv'] = {
['giveaccountmoney'] = 'ge spelarkonto pengar',
['invalid_item'] = 'ogiltigt föremål',
['item'] = 'föremål',
- ['giveitem'] = 'ge föremål',
+ ['giveitem'] = 'ge ett föremål',
['weapon'] = 'vapen',
- ['giveweapon'] = 'ge vapen',
+ ['giveweapon'] = 'ge ett vapen',
['chat_clear'] = 'töm chatten',
['chat_clear_all'] = 'töm chatten för alla',
- ['command_clearinventory'] = 'clear all items from inventory',
- ['command_clearloadout'] = 'remove all weapons from loadout',
- ['command_playerid_param'] = 'specify playerId or leave blank for yourself',
+ ['command_clearinventory'] = 'töm en spelares inventory',
+ ['command_clearloadout'] = 'töm en spelares loadout',
-- Locale settings
['locale_digit_grouping_symbol'] = ' ',
diff --git a/server/classes/player.lua b/server/classes/player.lua
index d5035e09..4a41d30b 100644
--- a/server/classes/player.lua
+++ b/server/classes/player.lua
@@ -1,41 +1,32 @@
-function CreateExtendedPlayer(player, accounts, inventory, job, loadout, name, coords)
+function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory, job, loadout, name, coords)
local self = {}
- self.player = player
- self.accounts = accounts
+ self.accounts = accounts
self.inventory = inventory
- self.job = job
- self.loadout = loadout
- self.name = name
+ self.job = job
+ self.group = group
+ self.loadout = loadout
+ self.name = name
self.maxWeight = Config.MaxWeight
- self.coords = coords
+ self.coords = coords
+ self.variables = {}
+ self.source = playerId
+ self.playerId = playerId
+ self.identifier = identifier
- self.source = self.player.get('source')
- self.identifier = self.player.get('identifier')
+ ExecuteCommand(('add_principal identifier.license:%s group.%s'):format(self.identifier, self.group))
self.triggerEvent = function(eventName, ...)
TriggerClientEvent(eventName, self.source, ...)
end
- self.setMoney = function(money)
- money = ESX.Math.Round(money)
-
- if money >= 0 then
- self.player.setMoney(money)
- end
- end
-
- self.getMoney = function()
- return self.player.get('money')
- end
-
self.setCoords = function(coords)
self.updateCoords(coords)
self.triggerEvent('esx:teleport', coords)
end
self.updateCoords = function(coords)
- self.coords = {x = ESX.Math.Round(coords.x, 1), y = ESX.Math.Round(coords.y, 1), z = ESX.Math.Round(coords.z, 1), heading = ESX.Math.Round(coords.heading, 1)}
+ self.coords = {x = ESX.Math.Round(coords.x, 1), y = ESX.Math.Round(coords.y, 1), z = ESX.Math.Round(coords.z, 1), heading = ESX.Math.Round(coords.heading or 0.0, 1)}
end
self.getCoords = function(vector)
@@ -50,78 +41,52 @@ function CreateExtendedPlayer(player, accounts, inventory, job, loadout, name, c
DropPlayer(self.source, reason)
end
+ self.setMoney = function(money)
+ money = ESX.Math.Round(money)
+ self.setAccountMoney('money', money)
+ end
+
+ self.getMoney = function()
+ return self.getAccount('money').money
+ end
+
self.addMoney = function(money)
money = ESX.Math.Round(money)
-
- if money >= 0 then
- self.player.addMoney(money)
- end
+ self.addAccountMoney('money', money)
end
self.removeMoney = function(money)
money = ESX.Math.Round(money)
-
- if money > 0 then
- self.player.removeMoney(money)
- end
- end
-
- self.displayMoney = function(money)
- self.player.displayMoney(money)
+ self.removeAccountMoney('money', money)
end
self.getIdentifier = function()
- return self.player.getIdentifier()
+ return self.identifier
+ end
+
+ self.setGroup = function(newGroup)
+ ExecuteCommand(('remove_principal identifier.license:%s group.%s'):format(self.identifier, self.group))
+ self.group = newGroup
+ ExecuteCommand(('add_principal identifier.license:%s group.%s'):format(self.identifier, self.group))
end
self.getGroup = function()
- return self.player.getGroup()
+ return self.group
end
self.set = function(k, v)
- self.player.set(k, v)
+ self.variables[k] = v
end
self.get = function(k)
- return self.player.get(k)
- end
-
- self.getPlayer = function()
- return self.player
+ return self.variables[k]
end
self.getAccounts = function()
- local accounts = {}
-
- for k,account in ipairs(Config.Accounts) do
- if account == 'bank' then
- table.insert(accounts, {
- name = 'bank',
- money = self.get('bank'),
- label = Config.AccountLabels.bank
- })
- else
- for k2,v2 in ipairs(self.accounts) do
- if v2.name == account then
- table.insert(accounts, v2)
- break
- end
- end
- end
- end
-
- return accounts
+ return self.accounts
end
self.getAccount = function(account)
- if account == 'bank' then
- return {
- name = 'bank',
- money = self.get('bank'),
- label = Config.AccountLabels.bank
- }
- end
-
for k,v in ipairs(self.accounts) do
if v.name == account then
return v
@@ -162,36 +127,29 @@ function CreateExtendedPlayer(player, accounts, inventory, job, loadout, name, c
end
self.getMissingAccounts = function(cb)
- MySQL.Async.fetchAll('SELECT name FROM user_accounts WHERE identifier = @identifier', {
- ['@identifier'] = self.getIdentifier()
- }, function(result)
- local missingAccounts = {}
+ local missingAccounts = {}
- for k,v in ipairs(Config.Accounts) do
- if v ~= 'bank' then
- local found = false
+ for account,label in pairs(Config.Accounts) do
+ local found = false
- for k2,v2 in ipairs(result) do
- if v == v2.name then
- found = true
- break
- end
- end
-
- if not found then
- table.insert(missingAccounts, v)
- end
+ for k2,v2 in ipairs(self.accounts) do
+ if account == v2.name then
+ found = true
end
end
- cb(missingAccounts)
- end)
+ if not found then
+ table.insert(missingAccounts, account)
+ end
+ end
+
+ cb(missingAccounts)
end
- self.createAccounts = function(missingAccounts, cb)
+ self.createMissingAccounts = function(missingAccounts, cb)
for k,v in ipairs(missingAccounts) do
MySQL.Async.execute('INSERT INTO user_accounts (identifier, name) VALUES (@identifier, @name)', {
- ['@identifier'] = self.getIdentifier(),
+ ['@identifier'] = self.identifier,
['@name'] = v
}, function(rowsChanged)
if cb then
diff --git a/server/commands.lua b/server/commands.lua
index dea5e1ee..23892beb 100644
--- a/server/commands.lua
+++ b/server/commands.lua
@@ -1,259 +1,111 @@
-TriggerEvent('es:addGroupCommand', 'tp', 'admin', function(source, args, user)
- local x = tonumber(args[1])
- local y = tonumber(args[2])
- local z = tonumber(args[3])
-
- if x and y and z then
- TriggerClientEvent('esx:teleport', source, {
- x = x,
- y = y,
- z = z
- })
- else
- TriggerClientEvent('chatMessage', source, 'SYSTEM', {255, 0, 0}, 'Invalid coordinates!')
- end
-end, function(source, args, user)
- TriggerClientEvent('chat:addMessage', source, { args = { '^1SYSTEM', 'Insufficient Permissions.' } })
-end, {help = 'Teleport to coordinates', params = {
- {name = 'x', help = 'X coords'},
- {name = 'y', help = 'Y coords'},
- {name = 'z', help = 'Z coords'}
+ESX.RegisterCommand('setcoords', 'admin', function(xPlayer, args, showError)
+ xPlayer.setCoords({x = args.x, y = args.y, z = args.z})
+end, false, {help = 'Teleport to coordinates', validate = true, arguments = {
+ {name = 'x', help = 'X coords', type = 'number'},
+ {name = 'y', help = 'Y coords', type = 'number'},
+ {name = 'z', help = 'Z coords', type = 'number'}
}})
-TriggerEvent('es:addGroupCommand', 'setjob', 'admin', function(source, args, user)
- if tonumber(args[1]) and args[2] and tonumber(args[3]) then
- local xPlayer = ESX.GetPlayerFromId(args[1])
+ESX.RegisterCommand('setjob', 'admin', function(xPlayer, args, showError)
+ if ESX.DoesJobExist(args.job, args.grade) then
+ args.playerId.setJob(args.job, args.grade)
+ else
+ showError('That job does not exist')
+ end
+end, true, {help = _U('setjob'), validate = true, arguments = {
+ {name = 'playerId', help = _U('id_param'), type = 'player'},
+ {name = 'job', help = _U('setjob_param2'), type = 'string'},
+ {name = 'grade', help = _U('setjob_param3'), type = 'number'}
+}})
- if xPlayer then
- if ESX.DoesJobExist(args[2], args[3]) then
- xPlayer.setJob(args[2], args[3])
+ESX.RegisterCommand('car', 'admin', function(xPlayer, args, showError)
+ xPlayer.triggerEvent('esx:spawnVehicle', args.car)
+end, false, {help = _U('spawn_car'), validate = false, arguments = {
+ {name = 'car', help = _U('spawn_car_param'), type = 'any'}
+}})
+
+ESX.RegisterCommand({'cardel', 'dv'}, 'admin', function(xPlayer, args, showError)
+ xPlayer.triggerEvent('esx:deleteVehicle', args.radius)
+end, false, {help = _U('spawn_car'), validate = false, arguments = {
+ {name = 'radius', help = 'Optional, delete every vehicle within the specified radius', type = 'any'}
+}})
+
+ESX.RegisterCommand('giveaccountmoney', 'admin', function(xPlayer, args, showError)
+ if args.playerId.getAccount(args.account) then
+ args.playerId.addAccountMoney(args.account, args.amount)
+ else
+ showError(_U('invalid_account'))
+ end
+end, true, {help = _U('giveaccountmoney'), validate = true, arguments = {
+ {name = 'playerId', help = _U('id_param'), type = 'player'},
+ {name = 'account', help = _U('account'), type = 'string'},
+ {name = 'amount', help = _U('money_amount'), type = 'number'}
+}})
+
+ESX.RegisterCommand('giveitem', 'admin', function(xPlayer, args, showError)
+ args.playerId.addInventoryItem(args.item, args.count)
+end, true, {help = _U('giveitem'), validate = true, arguments = {
+ {name = 'playerId', help = _U('id_param'), type = 'player'},
+ {name = 'item', help = _U('item'), type = 'item'},
+ {name = 'count', help = _U('amount'), type = 'number'}
+}})
+
+ESX.RegisterCommand('giveweapon', 'admin', function(xPlayer, args, showError)
+ if args.playerId.hasWeapon(args.weapon) then
+ showError('Player already has that weapon')
+ else
+ xPlayer.addWeapon(args.weapon, args.ammo)
+ end
+end, true, {help = _U('giveweapon'), validate = true, arguments = {
+ {name = 'playerId', help = _U('id_param'), type = 'player'},
+ {name = 'weapon', help = _U('weapon'), type = 'weapon'},
+ {name = 'ammo', help = _U('amountammo'), type = 'number'}
+}})
+
+ESX.RegisterCommand('giveweaponcomponent', 'admin', function(xPlayer, args, showError)
+ if args.playerId.hasWeapon(args.weaponName) then
+ local component = ESX.GetWeaponComponent(args.weaponName, args.componentName)
+
+ if component then
+ if xPlayer.hasWeaponComponent(args.weaponName, args.componentName) then
+ showError('Player already has that weapon component')
else
- TriggerClientEvent('chat:addMessage', source, { args = { '^1SYSTEM', 'That job does not exist.' } })
+ xPlayer.addWeaponComponent(args.weaponName, args.componentName)
end
else
- TriggerClientEvent('chat:addMessage', source, { args = { '^1SYSTEM', 'Player not online.' } })
+ showError('Invalid weapon component')
end
else
- TriggerClientEvent('chat:addMessage', source, { args = { '^1SYSTEM', 'Invalid usage.' } })
+ showError('Player does not have that weapon')
end
-end, function(source, args, user)
- TriggerClientEvent('chat:addMessage', source, { args = { '^1SYSTEM', 'Insufficient Permissions.' } })
-end, {help = _U('setjob'), params = {
- {name = 'playerId', help = _U('id_param')},
- {name = 'job', help = _U('setjob_param2')},
- {name = 'grade_id', help = _U('setjob_param3')}
+end, true, {help = 'Give weapon component', validate = true, arguments = {
+ {name = 'playerId', help = _U('id_param'), type = 'player'},
+ {name = 'weaponName', help = _U('weapon'), type = 'weapon'},
+ {name = 'componentName', help = 'weapon component', type = 'string'}
}})
-TriggerEvent('es:addGroupCommand', 'car', 'admin', function(source, args, user)
- TriggerClientEvent('esx:spawnVehicle', source, args[1])
-end, function(source, args, user)
- TriggerClientEvent('chat:addMessage', source, { args = { '^1SYSTEM', 'Insufficient Permissions.' } })
-end, {help = _U('spawn_car'), params = {{name = 'car', help = _U('spawn_car_param')}}})
+ESX.RegisterCommand({'clear', 'cls'}, 'user', function(xPlayer, args, showError)
+ xPlayer.triggerEvent('chat:clear')
+end, false, {help = _U('chat_clear')})
-TriggerEvent('es:addGroupCommand', 'cardel', 'admin', function(source, args, user)
- TriggerClientEvent('esx:deleteVehicle', source, args[1])
-end, function(source, args, user)
- TriggerClientEvent('chat:addMessage', source, { args = { '^1SYSTEM', 'Insufficient Permissions.' } })
-end, {help = _U('delete_vehicle'), params = {
- {name = 'radius', help = 'Optional, delete every vehicle within the specified radius'}
-}})
-
-TriggerEvent('es:addGroupCommand', 'dv', 'admin', function(source, args, user)
- TriggerClientEvent('esx:deleteVehicle', source, args[1])
-end, function(source, args, user)
- TriggerClientEvent('chat:addMessage', source, { args = { '^1SYSTEM', 'Insufficient Permissions.' } })
-end, {help = _U('delete_vehicle'), params = {
- {name = 'radius', help = 'Optional, delete every vehicle within the specified radius'}
-}})
-
-TriggerEvent('es:addGroupCommand', 'giveaccountmoney', 'admin', function(source, args, user)
- local xPlayer = ESX.GetPlayerFromId(args[1])
-
- if xPlayer then
- local account = args[2]
- local amount = tonumber(args[3])
-
- if amount then
- if account == 'cash' then
- xPlayer.addMoney(amount)
- elseif xPlayer.getAccount(account) then
- xPlayer.addAccountMoney(account, amount)
- else
- TriggerClientEvent('esx:showNotification', source, _U('invalid_account'))
- end
- else
- TriggerClientEvent('esx:showNotification', source, _U('amount_invalid'))
- end
- else
- TriggerClientEvent('chat:addMessage', source, { args = { '^1SYSTEM', 'Player not online.' } })
- end
-end, function(source, args, user)
- TriggerClientEvent('chat:addMessage', source, { args = { '^1SYSTEM', 'Insufficient Permissions.' } })
-end, {help = _U('giveaccountmoney'), params = {
- {name = 'playerId', 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 xPlayer = ESX.GetPlayerFromId(args[1])
-
- if xPlayer then
- local item = args[2]
- local count = tonumber(args[3])
-
- if count then
- if xPlayer.getInventoryItem(item) then
- xPlayer.addInventoryItem(item, count)
- else
- TriggerClientEvent('esx:showNotification', source, _U('invalid_item'))
- end
- else
- TriggerClientEvent('esx:showNotification', source, _U('invalid_amount'))
- end
- else
- TriggerClientEvent('chat:addMessage', source, { args = { '^1SYSTEM', 'Player not online.' } })
- end
-end, function(source, args, user)
- TriggerClientEvent('chat:addMessage', source, { args = { '^1SYSTEM', 'Insufficient Permissions.' } })
-end, {help = _U('giveitem'), params = {
- {name = 'playerId', 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[1])
-
- if xPlayer then
- local weaponName = args[2] or 'unknown'
-
- if ESX.GetWeapon(weaponName) then
- weaponName = string.upper(weaponName)
-
- if xPlayer.hasWeapon(weaponName) then
- TriggerClientEvent('chat:addMessage', source, { args = { '^1SYSTEM', 'Player already has that weapon.' } })
- else
- if tonumber(args[3]) then
- xPlayer.addWeapon(weaponName, tonumber(args[3]))
- else
- TriggerClientEvent('chat:addMessage', source, { args = { '^1SYSTEM', 'Invalid ammo amount.' } })
- end
- end
- else
- TriggerClientEvent('chat:addMessage', source, { args = { '^1SYSTEM', 'Invalid weapon.' } })
- end
- else
- TriggerClientEvent('chat:addMessage', source, { args = { '^1SYSTEM', 'Player not online.' } })
- end
-end, function(source, args, user)
- TriggerClientEvent('chat:addMessage', source, { args = { '^1SYSTEM', 'Insufficient Permissions.' } })
-end, {help = _U('giveweapon'), params = {
- {name = 'playerId', help = _U('id_param')},
- {name = 'weapon', help = _U('weapon')},
- {name = 'ammo', help = _U('amountammo')}
-}})
-
-TriggerEvent('es:addGroupCommand', 'giveweaponcomponent', 'admin', function(source, args, user)
- local xPlayer = ESX.GetPlayerFromId(args[1])
-
- if xPlayer then
- local weaponName = args[2] or 'unknown'
-
- if ESX.GetWeapon(weaponName) then
- weaponName = string.upper(weaponName)
-
- if xPlayer.hasWeapon(weaponName) then
- local component = ESX.GetWeaponComponent(weaponName, args[3] or 'unknown')
-
- if component then
- if xPlayer.hasWeaponComponent(weaponName, args[3]) then
- TriggerClientEvent('chat:addMessage', source, { args = { '^1SYSTEM', 'Player already has that weapon component.' } })
- else
- xPlayer.addWeaponComponent(weaponName, args[3])
- end
- else
- TriggerClientEvent('chat:addMessage', source, { args = { '^1SYSTEM', 'Invalid weapon component.' } })
- end
- else
- TriggerClientEvent('chat:addMessage', source, { args = { '^1SYSTEM', 'Player does not have that weapon.' } })
- end
- else
- TriggerClientEvent('chat:addMessage', source, { args = { '^1SYSTEM', 'Invalid weapon.' } })
- end
- else
- TriggerClientEvent('chat:addMessage', source, { args = { '^1SYSTEM', 'Player not online.' } })
- end
-end, function(source, args, user)
- TriggerClientEvent('chat:addMessage', source, { args = { '^1SYSTEM', 'Insufficient Permissions.' } })
-end, {help = 'Give weapon component', params = {
- {name = 'playerId', help = _U('id_param')},
- {name = 'weaponName', help = _U('weapon')},
- {name = 'componentName', help = 'weapon component'}
-}})
-
-TriggerEvent('es:addGroupCommand', 'clear', 'user', function(source, args, user)
- TriggerClientEvent('chat:clear', source)
-end, function(source, args, user)
- TriggerClientEvent('chat:addMessage', source, { args = { '^1SYSTEM', 'Insufficient Permissions.' } })
-end, {help = _U('chat_clear')})
-
-TriggerEvent('es:addGroupCommand', 'cls', 'user', function(source, args, user)
- TriggerClientEvent('chat:clear', source)
-end, function(source, args, user)
- TriggerClientEvent('chat:addMessage', source, { args = { '^1SYSTEM', 'Insufficient Permissions.' } })
-end)
-
-TriggerEvent('es:addGroupCommand', 'clsall', 'admin', function(source, args, user)
+ESX.RegisterCommand({'clearall', 'clsall'}, 'admin', function(xPlayer, args, showError)
TriggerClientEvent('chat:clear', -1)
-end, function(source, args, user)
- TriggerClientEvent('chat:addMessage', source, { args = { '^1SYSTEM', 'Insufficient Permissions.' } })
-end)
+end, false, {help = _U('chat_clear_all')})
-TriggerEvent('es:addGroupCommand', 'clearall', 'admin', function(source, args, user)
- TriggerClientEvent('chat:clear', -1)
-end, function(source, args, user)
- TriggerClientEvent('chat:addMessage', source, { args = { '^1SYSTEM', 'Insufficient Permissions.' } })
-end, {help = _U('chat_clear_all')})
-
-TriggerEvent('es:addGroupCommand', 'clearinventory', 'admin', function(source, args, user)
- local xPlayer
-
- if args[1] then
- xPlayer = ESX.GetPlayerFromId(args[1])
- else
- xPlayer = ESX.GetPlayerFromId(source)
- end
-
- if xPlayer then
- for i=1, #xPlayer.inventory, 1 do
- if xPlayer.inventory[i].count > 0 then
- xPlayer.setInventoryItem(xPlayer.inventory[i].name, 0)
- end
+ESX.RegisterCommand('clearinventory', 'admin', function(xPlayer, args, showError)
+ for k,v in ipairs(args.playerId.inventory) do
+ if v.count > 0 then
+ args.playerId.setInventoryItem(v.name, 0)
end
- else
- TriggerClientEvent('chat:addMessage', source, { args = { '^1SYSTEM', 'Player not online.' } })
end
-end, function(source, args, user)
- TriggerClientEvent('chat:addMessage', source, { args = { '^1SYSTEM', 'Insufficient Permissions.' } })
-end, {help = _U('command_clearinventory'), params = {{name = 'playerId', help = _U('command_playerid_param')}}})
+end, true, {help = _U('command_clearinventory'), validate = true, arguments = {
+ {name = 'playerId', help = _U('id_param'), type = 'player'}
+}})
-TriggerEvent('es:addGroupCommand', 'clearloadout', 'admin', function(source, args, user)
- local xPlayer
-
- if args[1] then
- xPlayer = ESX.GetPlayerFromId(args[1])
- else
- xPlayer = ESX.GetPlayerFromId(source)
+ESX.RegisterCommand('clearloadout', 'admin', function(xPlayer, args, showError)
+ for k,v in ipairs(args.playerId.loadout) do
+ args.playerId.removeWeapon(v.name)
end
-
- if xPlayer then
- for i=#xPlayer.loadout, 1, -1 do
- xPlayer.removeWeapon(xPlayer.loadout[i].name)
- end
- else
- TriggerClientEvent('chat:addMessage', source, { args = { '^1SYSTEM', 'Player not online.' } })
- end
-end, function(source, args, user)
- TriggerClientEvent('chat:addMessage', source, { args = { '^1SYSTEM', 'Insufficient Permissions.' } })
-end, {help = _U('command_clearloadout'), params = {{name = 'playerId', help = _U('command_playerid_param')}}})
+end, true, {help = _U('command_clearloadout'), validate = true, arguments = {
+ {name = 'playerId', help = _U('id_param'), type = 'player'}
+}})
diff --git a/server/common.lua b/server/common.lua
index e2496d75..b9d5f601 100644
--- a/server/common.lua
+++ b/server/common.lua
@@ -9,6 +9,7 @@ ESX.LastPlayerData = {}
ESX.Pickups = {}
ESX.PickupId = 0
ESX.Jobs = {}
+ESX.RegisteredCommands = {}
AddEventHandler('esx:getSharedObject', function(cb)
cb(ESX)
@@ -58,21 +59,14 @@ MySQL.ready(function()
end)
AddEventHandler('esx:playerLoaded', function(playerId)
- local xPlayer, accounts, items = ESX.GetPlayerFromId(playerId), {}, {}
- local xPlayerAccounts, xPlayerItems = xPlayer.getAccounts(), xPlayer.getInventory()
+ local xPlayer, accounts = ESX.GetPlayerFromId(playerId), {}
+ local xPlayerAccounts = xPlayer.getAccounts()
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
-
- ESX.LastPlayerData[playerId] = {
- accounts = accounts,
- items = items
- }
+ ESX.LastPlayerData[playerId] = {accounts = accounts}
end)
RegisterServerEvent('esx:clientLog')
diff --git a/server/functions.lua b/server/functions.lua
index 83c2debc..6cfd5860 100644
--- a/server/functions.lua
+++ b/server/functions.lua
@@ -20,6 +20,115 @@ ESX.SetTimeout = function(msec, cb)
return id
end
+ESX.RegisterCommand = function(name, group, cb, allowConsole, suggestion)
+ if type(name) == 'table' then
+ for k,v in ipairs(name) do
+ ESX.RegisterCommand(v, group, cb, allowConsole, suggestion)
+ end
+
+ return
+ end
+
+ if ESX.RegisteredCommands[name] then
+ print(('[es_extended] [^3WARNING^7] An command "%s" is already registered'):format(name))
+ else
+ if suggestion then
+ if not suggestion.arguments then suggestion.arguments = {} end
+ if not suggestion.help then suggestion.help = '' end
+ end
+
+ ESX.RegisteredCommands[name] = {group = group, cb = cb, allowConsole = allowConsole, suggestion = suggestion}
+
+ RegisterCommand(name, function(playerId, args, rawCommand)
+ local command = ESX.RegisteredCommands[name]
+
+ if not command.allowConsole and playerId == 0 then
+ print('[es_extended] [^3WARNING^7] That command can not be run from console')
+ else
+ local xPlayer, error = ESX.GetPlayerFromId(playerId), nil
+
+ if command.suggestion then
+ if command.suggestion.validate then
+ if #args ~= #command.suggestion.arguments then
+ error = ('Argument count mismatch (passed %s, wanted %s)'):format(#args, #command.suggestion.arguments)
+ end
+ end
+
+ if not error and command.suggestion.arguments then
+ local newArgs = {}
+
+ for k,v in ipairs(command.suggestion.arguments) do
+ if v.type then
+ if v.type == 'number' then
+ local newArg = tonumber(args[k])
+
+ if newArg then
+ newArgs[v.name] = newArg
+ else
+ error = ('Argument #%s type mismatch (passed string, wanted number)'):format(k)
+ end
+ elseif v.type == 'player' then
+ local targetPlayer = tonumber(args[k])
+
+ if targetPlayer then
+ local xTargetPlayer = ESX.GetPlayerFromId(targetPlayer)
+
+ if xTargetPlayer then
+ newArgs[v.name] = xTargetPlayer
+ else
+ error = 'Player not online'
+ end
+ else
+ error = ('Argument #%s type mismatch (passed string, wanted number)'):format(k)
+ end
+ elseif v.type == 'string' then
+ newArgs[v.name] = args[k]
+ elseif v.type == 'item' then
+ if ESX.Items[args[k]] then
+ newArgs[v.name] = args[k]
+ else
+ error = _U('invalid_item')
+ end
+ elseif v.type == 'weapon' then
+ if ESX.GetWeapon(args[k]) then
+ newArgs[v.name] = string.upper(args[k])
+ else
+ error = 'Invalid weapon'
+ end
+ elseif v.type == 'any' then
+ newArgs[v.name] = args[k]
+ end
+ end
+
+ if error then break end
+ end
+
+ args = newArgs
+ end
+ end
+
+ if error then
+ if playerId == 0 then
+ print(('[es_extended] [^3WARNING^7] %s^7'):format(error))
+ else
+ xPlayer.triggerEvent('chat:addMessage', {args = {'^1SYSTEM', error}})
+ end
+ else
+ cb(xPlayer, args, function(msg)
+ if playerId == 0 then
+ print(('[es_extended] [^3WARNING^7] %s^7'):format(msg))
+ else
+ xPlayer.triggerEvent('chat:addMessage', {args = {'^1SYSTEM', msg}})
+ end
+ end)
+ end
+ end
+ end, true)
+
+ ExecuteCommand(('add_ace group.%s command.%s allow'):format(group, name))
+ end
+end
+
ESX.ClearTimeout = function(id)
ESX.CancelledTimeouts[id] = true
end
@@ -44,9 +153,9 @@ ESX.SavePlayer = function(xPlayer, cb)
if ESX.LastPlayerData[xPlayer.source].accounts[v.name] ~= v.money then
table.insert(asyncTasks, function(cb)
MySQL.Async.execute('UPDATE user_accounts SET money = @money WHERE identifier = @identifier AND name = @name', {
- ['@money'] = v.money,
+ ['@money'] = v.money,
['@identifier'] = xPlayer.identifier,
- ['@name'] = v.name
+ ['@name'] = v.name
}, function(rowsChanged)
cb()
end)
diff --git a/server/main.lua b/server/main.lua
index d079ded5..38bd8926 100644
--- a/server/main.lua
+++ b/server/main.lua
@@ -1,4 +1,38 @@
-AddEventHandler('es:playerLoaded', function(playerId, player)
+RegisterNetEvent('esx:playerJoined')
+AddEventHandler('esx:playerJoined', function()
+ onPlayerJoined(source)
+end)
+
+function onPlayerJoined(playerId)
+ local identifier
+
+ for k,v in ipairs(GetPlayerIdentifiers(playerId)) do
+ if string.match(v, 'license:') then
+ identifier = string.sub(v, 9)
+ break
+ end
+ end
+
+ if identifier then
+ MySQL.Async.fetchScalar('SELECT 1 FROM users WHERE identifier = @identifier', {
+ ['@identifier'] = identifier
+ }, function(result)
+ if result then
+ loadESXPlayer(identifier, playerId)
+ else
+ MySQL.Async.execute('INSERT INTO users (identifier) VALUES (@identifier)', {
+ ['@identifier'] = identifier
+ }, function(rowsChanged)
+ loadESXPlayer(identifier, playerId)
+ end)
+ end
+ end)
+ else
+ DropPlayer(playerId, 'Your Rockstar license could not be found')
+ end
+end
+
+function loadESXPlayer(identifier, playerId)
local tasks = {}
local userData = {
@@ -6,22 +40,20 @@ AddEventHandler('es:playerLoaded', function(playerId, player)
inventory = {},
job = {},
loadout = {},
- playerName = GetPlayerName(playerId),
- coords = nil
+ playerName = GetPlayerName(playerId)
}
- -- Get accounts
+ -- get accounts
table.insert(tasks, function(cb)
MySQL.Async.fetchAll('SELECT name, money FROM user_accounts WHERE identifier = @identifier', {
- ['@identifier'] = player.getIdentifier()
+ ['@identifier'] = identifier
}, function(accounts)
- local validAccounts = ESX.Table.Set(Config.Accounts)
for k,v in ipairs(accounts) do
- if validAccounts[v.name] then
+ if Config.Accounts[v.name] then
table.insert(userData.accounts, {
name = v.name,
money = v.money,
- label = Config.AccountLabels[v.name]
+ label = Config.Accounts[v.name]
})
end
end
@@ -30,147 +62,120 @@ AddEventHandler('es:playerLoaded', function(playerId, player)
end)
end)
- -- Get job and loadout
table.insert(tasks, function(cb)
+ MySQL.Async.fetchAll('SELECT job, job_grade, `group`, loadout, position, inventory FROM users WHERE identifier = @identifier', {
+ ['@identifier'] = identifier
+ }, function(result)
+ local job, grade, jobObject, gradeObject = result[1].job, tostring(result[1].job_grade)
- local tasks2 = {}
+ if ESX.DoesJobExist(job, grade) then
+ jobObject, gradeObject = ESX.Jobs[job], ESX.Jobs[job].grades[grade]
+ else
+ print(('[es_extended] [^3WARNING^7] Ignoring invalid job for %s [job: %s, grade: %s]'):format(identifier, job, grade))
+ job, grade = 'unemployed', '0'
+ jobObject, gradeObject = ESX.Jobs[job], ESX.Jobs[job].grades[grade]
+ end
- -- Get job name, grade and coords
- table.insert(tasks2, function(cb2)
+ userData.job = {}
- MySQL.Async.fetchAll('SELECT job, job_grade, loadout, position, inventory FROM users WHERE identifier = @identifier', {
- ['@identifier'] = player.getIdentifier()
- }, function(result)
- local job, grade = result[1].job, tostring(result[1].job_grade)
+ userData.job.id = jobObject.id
+ userData.job.name = jobObject.name
+ userData.job.label = jobObject.label
- if ESX.DoesJobExist(job, grade) then
- local jobObject, gradeObject = ESX.Jobs[job], ESX.Jobs[job].grades[grade]
+ userData.job.grade = tonumber(grade)
+ userData.job.grade_name = gradeObject.name
+ userData.job.grade_label = gradeObject.label
+ userData.job.grade_salary = gradeObject.salary
- userData.job = {}
+ userData.job.skin_male = {}
+ userData.job.skin_female = {}
- userData.job.id = jobObject.id
- userData.job.name = jobObject.name
- userData.job.label = jobObject.label
+ if gradeObject.skin_male then userData.job.skin_male = json.decode(gradeObject.skin_male) end
+ if gradeObject.skin_female then userData.job.skin_female = json.decode(gradeObject.skin_female) end
- userData.job.grade = tonumber(grade)
- userData.job.grade_name = gradeObject.name
- userData.job.grade_label = gradeObject.label
- userData.job.grade_salary = gradeObject.salary
+ local foundItems = {}
- userData.job.skin_male = {}
- userData.job.skin_female = {}
+ if result[1].inventory and result[1].inventory ~= '' then
+ local inventory = json.decode(result[1].inventory)
- if gradeObject.skin_male then
- userData.job.skin_male = json.decode(gradeObject.skin_male)
- end
+ for name,count in pairs(inventory) do
+ local item = ESX.Items[name]
- if gradeObject.skin_female then
- userData.job.skin_female = json.decode(gradeObject.skin_female)
- end
- else
- print(('[es_extended] [^3WARNING^7] Ignoring invalid job for %s [job: %s, grade: %s]'):format(player.getIdentifier(), job, grade))
-
- local job, grade = 'unemployed', '0'
- local jobObject, gradeObject = ESX.Jobs[job], ESX.Jobs[job].grades[grade]
-
- userData.job = {}
-
- userData.job.id = jobObject.id
- userData.job.name = jobObject.name
- userData.job.label = jobObject.label
-
- userData.job.grade = tonumber(grade)
- userData.job.grade_name = gradeObject.name
- userData.job.grade_label = gradeObject.label
- userData.job.grade_salary = gradeObject.salary
-
- userData.job.skin_male = {}
- userData.job.skin_female = {}
- end
-
- local foundItems = {}
-
- if result[1].inventory and result[1].inventory ~= '' then
- local inventory = json.decode(result[1].inventory)
-
- for name,count in pairs(inventory) do
- local item = ESX.Items[name]
-
- if item then
- foundItems[name] = count
- else
- print(('[es_extended] [^3WARNING^7] Ignoring invalid item "%s" for "%s"'):format(name, player.getIdentifier()))
- end
+ if item then
+ foundItems[name] = count
+ else
+ print(('[es_extended] [^3WARNING^7] Ignoring invalid item "%s" for "%s"'):format(name, identifier))
end
end
+ end
- for name,item in pairs(ESX.Items) do
- local count = foundItems[name] or 0
+ for name,item in pairs(ESX.Items) do
+ local count = foundItems[name] or 0
- table.insert(userData.inventory, {
- name = name,
- count = count,
- label = item.label,
- weight = item.weight,
- usable = ESX.UsableItemsCallbacks[name] ~= nil,
- rare = item.rare,
- canRemove = item.canRemove
- })
- end
+ table.insert(userData.inventory, {
+ name = name,
+ count = count,
+ label = item.label,
+ weight = item.weight,
+ usable = ESX.UsableItemsCallbacks[name] ~= nil,
+ rare = item.rare,
+ canRemove = item.canRemove
+ })
+ end
- table.sort(userData.inventory, function(a,b)
- return a.label < b.label
- end)
+ if result[1].group then
+ userData.group = result[1].group
+ else
+ userData.group = 'user'
+ end
- if result[1].loadout then
- userData.loadout = json.decode(result[1].loadout)
-
- -- compatibility with old loadouts
- for k,v in ipairs(userData.loadout) do
- if not v.components then v.components = {} end
- if not v.tintIndex then v.tintIndex = 0 end
- end
- end
-
- if result[1].position and result[1].position ~= '' then
- userData.coords = json.decode(result[1].position)
- else
- print('[es_extended] [^3WARNING^7] Column "position" in "users" table is missing required default value. Using backup coords, fix your database.')
- userData.coords = {x = -269.4, y = -955.3, z = 31.2, heading = 205.8}
- end
-
- cb2()
+ table.sort(userData.inventory, function(a, b)
+ return a.label < b.label
end)
+ if result[1].loadout then
+ userData.loadout = json.decode(result[1].loadout)
+
+ -- compatibility with old loadouts
+ for k,v in ipairs(userData.loadout) do
+ if not v.components then v.components = {} end
+ if not v.tintIndex then v.tintIndex = 0 end
+ end
+ end
+
+ if result[1].position and result[1].position ~= '' then
+ userData.coords = json.decode(result[1].position)
+ else
+ print('[es_extended] [^3WARNING^7] Column "position" in "users" table is missing required default value. Using backup coords, fix your database.')
+ userData.coords = {x = -269.4, y = -955.3, z = 31.2, heading = 205.8}
+ end
+
+ cb()
end)
-
- Async.series(tasks2, cb)
-
end)
- -- Run Tasks
Async.parallel(tasks, function(results)
- local xPlayer = CreateExtendedPlayer(player, userData.accounts, userData.inventory, userData.job, userData.loadout, userData.playerName, userData.coords)
+ local xPlayer = CreateExtendedPlayer(playerId, identifier, userData.group, userData.accounts, userData.inventory, userData.job, userData.loadout, userData.playerName, userData.coords)
xPlayer.getMissingAccounts(function(missingAccounts)
if #missingAccounts > 0 then
- for i=1, #missingAccounts, 1 do
+ for k,v in ipairs(missingAccounts) do
table.insert(xPlayer.accounts, {
- name = missingAccounts[i],
+ name = v,
money = 0,
- label = Config.AccountLabels[missingAccounts[i]]
+ label = Config.Accounts[v]
})
end
- xPlayer.createAccounts(missingAccounts)
+ xPlayer.createMissingAccounts(missingAccounts)
end
ESX.Players[playerId] = xPlayer
-
TriggerEvent('esx:playerLoaded', playerId, xPlayer)
xPlayer.triggerEvent('esx:playerLoaded', {
identifier = xPlayer.identifier,
+ money = xPlayer.getMoney(),
accounts = xPlayer.getAccounts(),
coords = xPlayer.getCoords(),
inventory = xPlayer.getInventory(),
@@ -180,11 +185,10 @@ AddEventHandler('es:playerLoaded', function(playerId, player)
maxWeight = xPlayer.maxWeight
})
- xPlayer.displayMoney(xPlayer.getMoney())
xPlayer.triggerEvent('esx:createMissingPickups', ESX.Pickups)
end)
end)
-end)
+end
AddEventHandler('playerDropped', function(reason)
local playerId = source
@@ -238,23 +242,13 @@ AddEventHandler('esx:giveInventoryItem', function(target, type, itemName, itemCo
else
sourceXPlayer.showNotification(_U('imp_invalid_quantity'))
end
- elseif type == 'item_money' then
- if itemCount > 0 and sourceXPlayer.getMoney() >= itemCount then
- sourceXPlayer.removeMoney(itemCount)
- targetXPlayer.addMoney (itemCount)
-
- sourceXPlayer.showNotification(_U('gave_money', ESX.Math.GroupDigits(itemCount), targetXPlayer.name))
- targetXPlayer.showNotification(_U('received_money', ESX.Math.GroupDigits(itemCount), sourceXPlayer.name))
- else
- sourceXPlayer.showNotification(_U('imp_invalid_amount'))
- end
elseif type == 'item_account' then
if itemCount > 0 and sourceXPlayer.getAccount(itemName).money >= itemCount then
sourceXPlayer.removeAccountMoney(itemName, itemCount)
targetXPlayer.addAccountMoney (itemName, itemCount)
- sourceXPlayer.showNotification(_U('gave_account_money', ESX.Math.GroupDigits(itemCount), Config.AccountLabels[itemName], targetXPlayer.name))
- targetXPlayer.showNotification(_U('received_account_money', ESX.Math.GroupDigits(itemCount), Config.AccountLabels[itemName], sourceXPlayer.name))
+ sourceXPlayer.showNotification(_U('gave_account_money', ESX.Math.GroupDigits(itemCount), Config.Accounts[itemName], targetXPlayer.name))
+ targetXPlayer.showNotification(_U('received_account_money', ESX.Math.GroupDigits(itemCount), Config.Accounts[itemName], sourceXPlayer.name))
else
sourceXPlayer.showNotification(_U('imp_invalid_amount'))
end
@@ -328,21 +322,6 @@ AddEventHandler('esx:removeInventoryItem', function(type, itemName, itemCount)
xPlayer.showNotification(_U('threw_standard', itemCount, xItem.label))
end
end
- elseif type == 'item_money' then
- if itemCount == nil or itemCount < 1 then
- xPlayer.showNotification(_U('imp_invalid_amount'))
- else
- local playerCash = xPlayer.getMoney()
-
- if (itemCount > playerCash or playerCash < 1) then
- xPlayer.showNotification(_U('imp_invalid_amount'))
- else
- xPlayer.removeMoney(itemCount)
- local pickupLabel = ('~y~%s~s~ [~g~%s~s~]'):format(_U('cash'), _U('locale_currency', ESX.Math.GroupDigits(itemCount)))
- ESX.CreatePickup('item_money', 'money', itemCount, pickupLabel, playerId)
- xPlayer.showNotification(_U('threw_money', ESX.Math.GroupDigits(itemCount)))
- end
- end
elseif type == 'item_account' then
if itemCount == nil or itemCount < 1 then
xPlayer.showNotification(_U('imp_invalid_amount'))
@@ -406,9 +385,6 @@ AddEventHandler('esx:onPickup', function(id)
else
xPlayer.showNotification(_U('threw_cannot_pickup'))
end
- elseif pickup.type == 'item_money' then
- success = true
- xPlayer.addMoney(pickup.count)
elseif pickup.type == 'item_account' then
success = true
xPlayer.addAccountMoney(pickup.name, pickup.count)