From 71c704ed856750a9ba681034935be64c5fc22f2a Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Tue, 3 Jul 2018 13:05:23 +0200 Subject: [PATCH] General cleanup, added missing locale strings --- README.md | 41 +++++++++++++++++++++++++++++++---------- __resource.lua | 48 ++++++++++++++++++++++++++---------------------- client/main.lua | 17 ++++++++--------- config.lua | 40 +++++++++++++++++++--------------------- locales/br.lua | 12 +++++------- locales/de.lua | 16 ++++++++-------- locales/en.lua | 11 +++++------ locales/es.lua | 8 ++++---- locales/fi.lua | 11 +++++------ locales/fr.lua | 11 +++++------ locales/sv.lua | 17 ++++++++--------- server/main.lua | 28 +++++++--------------------- 12 files changed, 131 insertions(+), 129 deletions(-) diff --git a/README.md b/README.md index 8a846386..354ec1cd 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,40 @@ -# fxserver-esx_clotheshop -FXServer ESX ClotheShop +# esx_clotheshop -[REQUIREMENTS] +## Requirements +- [esx_skin](https://github.com/ESX-Org/esx_clotheshop) -- esx_skin => https://github.com/FXServer-ESX/fxserver-esx_skin +## Download & Installation -[INSTALLATION] - -1) CD in your resources/[esx] folder -2) Clone the repository +### Using [fvm](https://github.com/qlaffont/fvm-installer) ``` -git clone https://github.com/FXServer-ESX/fxserver-esx_clotheshop clotheshop +fvm install --save --folder=esx esx-org/esx_clotheshop ``` -3) Add this in your server.cfg : + +### Using Git +``` +cd resources +git clone https://github.com/ESX-Org/esx_clotheshop [esx]/esx_clotheshop +``` + +### Manually +- Download https://github.com/ESX-Org/esx_clotheshop/archive/master.zip +- Put it in the `[esx]` directory + +## Installation +- Add this in your `server.cfg`: ``` start esx_clotheshop ``` + +# Legal +### License +esx_clotheshop - clothing store + +Copyright (C) 2015-2018 Jérémie N'gadi + +This program Is free software: you can redistribute it And/Or modify it under the terms Of the GNU General Public License As published by the Free Software Foundation, either version 3 Of the License, Or (at your option) any later version. + +This program Is distributed In the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty Of MERCHANTABILITY Or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License For more details. + +You should have received a copy Of the GNU General Public License along with this program. If Not, see http://www.gnu.org/licenses/. \ No newline at end of file diff --git a/__resource.lua b/__resource.lua index b232d450..e1cb56b4 100644 --- a/__resource.lua +++ b/__resource.lua @@ -2,32 +2,36 @@ resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937' description 'ESX ClotheShop' -version '1.0.0' +version '1.1.0' server_scripts { - '@mysql-async/lib/MySQL.lua', - '@es_extended/locale.lua', - 'locales/br.lua', - 'locales/de.lua', - 'locales/en.lua', - 'locales/fi.lua', - 'locales/fr.lua', - 'locales/es.lua', - 'locales/sv.lua', - 'config.lua', - 'server/main.lua' + '@mysql-async/lib/MySQL.lua', + '@es_extended/locale.lua', + 'locales/br.lua', + 'locales/de.lua', + 'locales/en.lua', + 'locales/fi.lua', + 'locales/fr.lua', + 'locales/es.lua', + 'locales/sv.lua', + 'config.lua', + 'server/main.lua' } client_scripts { - '@es_extended/locale.lua', - 'locales/br.lua', - 'locales/de.lua', - 'locales/en.lua', - 'locales/fi.lua', - 'locales/fr.lua', - 'locales/es.lua', - 'locales/sv.lua', - 'config.lua', - 'client/main.lua' + '@es_extended/locale.lua', + 'locales/br.lua', + 'locales/de.lua', + 'locales/en.lua', + 'locales/fi.lua', + 'locales/fr.lua', + 'locales/es.lua', + 'locales/sv.lua', + 'config.lua', + 'client/main.lua' } +dependencies { + 'es_extended', + 'esx_skin' +} \ No newline at end of file diff --git a/client/main.lua b/client/main.lua index 394d6edf..d8e9a9b5 100644 --- a/client/main.lua +++ b/client/main.lua @@ -11,8 +11,6 @@ local Keys = { } ESX = nil -local GUI = {} -GUI.Time = 0 local HasAlreadyEnteredMarker = false local LastZone = nil local CurrentAction = nil @@ -173,8 +171,8 @@ function OpenShopMenu() 'pants_2', 'shoes_1', 'shoes_2', - 'chain_1', - 'chain_2', + 'chain_1', + 'chain_2', 'helmet_1', 'helmet_2', 'glasses_1', @@ -228,7 +226,7 @@ end) Citizen.CreateThread(function() while true do - Wait(0) + Citizen.Wait(1) local coords = GetEntityCoords(GetPlayerPed(-1)) @@ -245,7 +243,7 @@ end) Citizen.CreateThread(function() while true do - Wait(0) + Citizen.Wait(10) local coords = GetEntityCoords(GetPlayerPed(-1)) local isInMarker = false @@ -276,7 +274,7 @@ end) Citizen.CreateThread(function() while true do - Citizen.Wait(0) + Citizen.Wait(10) if CurrentAction ~= nil then @@ -284,17 +282,18 @@ Citizen.CreateThread(function() AddTextComponentString(CurrentActionMsg) DisplayHelpTextFromStringLabel(0, 0, 1, -1) - if IsControlPressed(0, Keys['E']) and (GetGameTimer() - GUI.Time) > 300 then + if IsControlJustReleased(0, Keys['E']) then if CurrentAction == 'shop_menu' then OpenShopMenu() end CurrentAction = nil - GUI.Time = GetGameTimer() end + else + Citizen.Wait(500) end end diff --git a/config.lua b/config.lua index 8d335bd7..9a8daa48 100644 --- a/config.lua +++ b/config.lua @@ -11,29 +11,27 @@ Config.MarkerType = 1 Config.Zones = {} Config.Shops = { - {x=72.254, y=-1399.102, z=28.376}, - {x=-703.776, y=-152.258, z=36.415}, - {x=-167.863, y=-298.969, z=38.733}, - {x=428.694, y=-800.106, z=28.491}, - {x=-829.413, y=-1073.710, z=10.328}, - {x=-1447.797, y=-242.461, z=48.820}, - {x=11.632, y=6514.224, z=30.877}, - {x=123.646, y=-219.440, z=53.557}, - {x=1696.291, y=4829.312, z=41.063}, - {x=618.093, y=2759.629, z=41.088}, - {x=1190.550, y=2713.441, z=37.222}, - {x=-1193.429, y=-772.262, z=16.324}, - {x=-3172.496, y=1048.133, z=19.863}, - {x=-1108.441, y=2708.923, z=18.107}, + {x=72.254, y=-1399.102, z=28.376}, + {x=-703.776, y=-152.258, z=36.415}, + {x=-167.863, y=-298.969, z=38.733}, + {x=428.694, y=-800.106, z=28.491}, + {x=-829.413, y=-1073.710, z=10.328}, + {x=-1447.797, y=-242.461, z=48.820}, + {x=11.632, y=6514.224, z=30.877}, + {x=123.646, y=-219.440, z=53.557}, + {x=1696.291, y=4829.312, z=41.063}, + {x=618.093, y=2759.629, z=41.088}, + {x=1190.550, y=2713.441, z=37.222}, + {x=-1193.429, y=-772.262, z=16.324}, + {x=-3172.496, y=1048.133, z=19.863}, + {x=-1108.441, y=2708.923, z=18.107} } for i=1, #Config.Shops, 1 do - Config.Zones['Shop_' .. i] = { - Pos = Config.Shops[i], - Size = Config.MarkerSize, - Color = Config.MarkerColor, - Type = Config.MarkerType - } - + Pos = Config.Shops[i], + Size = Config.MarkerSize, + Color = Config.MarkerColor, + Type = Config.MarkerType + } end diff --git a/locales/br.lua b/locales/br.lua index 18c6faa1..ec49be27 100644 --- a/locales/br.lua +++ b/locales/br.lua @@ -1,14 +1,12 @@ Locales['br'] = { - ['valid_this_purchase'] = 'validar esta compra?', ['yes'] = 'sim', ['no'] = 'não', - ['save_in_dressing'] = 'você quer salvar essa roupa?', - ['name_outfit'] = 'nome da roupa?', - ['saved_outfit'] = 'roupa salva', ['not_enough_money'] = 'você não tem dinheiro suficiente', ['press_menu'] = 'pressione ~INPUT_CONTEXT~ para acessar o menu', ['clothes'] = 'roupas', - ['you_paid'] = 'você pagou $', - -} + ['you_paid'] = 'você pagou ~g~$%s~s~', + ['save_in_dressing'] = 'você quer salvar essa roupa?', + ['name_outfit'] = 'nome da roupa?', + ['saved_outfit'] = 'roupa salva', +} \ No newline at end of file diff --git a/locales/de.lua b/locales/de.lua index 700a986b..6e93f504 100644 --- a/locales/de.lua +++ b/locales/de.lua @@ -1,12 +1,12 @@ Locales['de'] = { - - ['valid_this_purchase'] = 'Einkauf bestätigen?', + ['valid_this_purchase'] = 'einkauf bestätigen?', ['yes'] = 'ja', ['no'] = 'nein', - ['name_outfit'] = 'Name des Outfits?', ['not_enough_money'] = 'du hast nicht genug Geld', - ['press_menu'] = 'Drücke ~INPUT_CONTEXT~ um das Menü zu öffnen', - ['clothes'] = 'Kleidung', - ['you_paid'] = 'du bezahlst $', - -} + ['press_menu'] = 'drücke ~INPUT_CONTEXT~ um das Menü zu öffnen', + ['clothes'] = 'kleidung', + ['you_paid'] = 'du bezahlst ~g~$%s~s~', + ['save_in_dressing'] = 'do you want to save the outfit in your property?', + ['name_outfit'] = 'name des outfits?', + ['saved_outfit'] = 'the outfit has been saved!', +} \ No newline at end of file diff --git a/locales/en.lua b/locales/en.lua index 302e5754..7f8ea521 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -1,13 +1,12 @@ Locales['en'] = { - ['valid_this_purchase'] = 'validate this purchase?', ['yes'] = 'yes', ['no'] = 'no', - ['name_outfit'] = 'name of the outfit?', ['not_enough_money'] = 'you do not have enough money', ['press_menu'] = 'press ~INPUT_CONTEXT~ to access the menu', ['clothes'] = 'clothes', - ['you_paid'] = 'you paid $', - ['save_in_dressing'] = 'Do you want to give a name to your outfit ?', - -} + ['you_paid'] = 'you paid ~g~$%s~s~', + ['save_in_dressing'] = 'do you want to save the outfit in your property?', + ['name_outfit'] = 'name your outfit', + ['saved_outfit'] = 'the outfit has been saved!', +} \ No newline at end of file diff --git a/locales/es.lua b/locales/es.lua index 6b324646..c4f84700 100644 --- a/locales/es.lua +++ b/locales/es.lua @@ -1,12 +1,12 @@ Locales['es'] = { - ['valid_this_purchase'] = '¿Validar esta compra?', ['yes'] = 'Si', ['no'] = 'No', - ['name_outfit'] = 'Nombre del traje ?', ['not_enough_money'] = 'No tienes suficiente dinero', ['press_menu'] = 'Presiona ~INPUT_CONTEXT~ para acceder al menú', ['clothes'] = 'Ropa', - ['you_paid'] = 'Has pagado €', + ['you_paid'] = 'Has pagado ~g~€%s~s~', ['save_in_dressing'] = '¿Quieres darle un nombre a tu vestuario?', -} + ['name_outfit'] = 'nombre del traje?', + ['saved_outfit'] = 'the outfit has been saved!', +} \ No newline at end of file diff --git a/locales/fi.lua b/locales/fi.lua index 8e9ce28a..27182c28 100644 --- a/locales/fi.lua +++ b/locales/fi.lua @@ -1,13 +1,12 @@ Locales['fi'] = { - ['valid_this_purchase'] = 'varmista tämä ostos?', ['yes'] = 'kyllä', ['no'] = 'ei', - ['name_outfit'] = 'asun nimi?', ['not_enough_money'] = 'sinulla ei ole tarpeeksi rahaa', ['press_menu'] = 'paina ~INPUT_CONTEXT~ avataksesi menu', - ['clothes'] = 'Vaatekauppa', - ['you_paid'] = 'sinä maksoit $', + ['clothes'] = 'vaatekauppa', + ['you_paid'] = 'sinä maksoit ~g~$%s~s~', ['save_in_dressing'] = 'haluatko antaa nimen asulle ?', - -} + ['name_outfit'] = 'asun nimi?', + ['saved_outfit'] = 'the outfit has been saved!', +} \ No newline at end of file diff --git a/locales/fr.lua b/locales/fr.lua index 44ae4f02..98fe7a88 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -1,13 +1,12 @@ Locales['fr'] = { - ['valid_this_purchase'] = 'valider cet achat ?', ['yes'] = 'oui', ['no'] = 'non', - ['name_outfit'] = 'nom de la tenue ?', ['not_enough_money'] = 'vous n\'avez pas assez d\'argent', ['press_menu'] = 'appuyez sur ~INPUT_CONTEXT~ pour accéder au menu', ['clothes'] = 'vêtements', - ['you_paid'] = 'vous avez payé $', - ['save_in_dressing'] = 'voulez-vous donner un nom à votre tenue ?', - -} + ['you_paid'] = 'vous avez payé ~g~$%s~s~', + ['save_in_dressing'] = 'voulez-vous donner un nom à votre tenue?', + ['name_outfit'] = 'nom de la tenue?', + ['saved_outfit'] = 'the outfit has been saved!', +} \ No newline at end of file diff --git a/locales/sv.lua b/locales/sv.lua index a6189b47..1f5c37d1 100644 --- a/locales/sv.lua +++ b/locales/sv.lua @@ -1,13 +1,12 @@ Locales['sv'] = { - - ['valid_this_purchase'] = 'bekräfta detta köp?', + ['valid_this_purchase'] = 'vill du köpa dessa kläder?', ['yes'] = 'ja', ['no'] = 'nej', - ['name_outfit'] = 'namn på outfit?', - ['not_enough_money'] = 'du har inte tillräckligt med pengar', - ['press_menu'] = 'tryck på ~INPUT_CONTEXT~ för att komma åt menyn', + ['not_enough_money'] = 'du har ~r~inte råd~s~ för att köpa detta', + ['press_menu'] = 'tryck ~INPUT_CONTEXT~ för att komma åt menyn', ['clothes'] = 'kläder', - ['you_paid'] = 'du betalade $', - ['save_in_dressing'] = 'Vill du namnge din outfit?', - -} + ['you_paid'] = 'du har betalat ~g~$%s~s~', + ['save_in_dressing'] = 'vill du spara outfiten i din fastighet?', + ['name_outfit'] = 'vad ska din outfit heta?', + ['saved_outfit'] = 'outfit har sparats!', +} \ No newline at end of file diff --git a/server/main.lua b/server/main.lua index 6661e6dc..6a4d035a 100644 --- a/server/main.lua +++ b/server/main.lua @@ -4,21 +4,18 @@ TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) RegisterServerEvent('esx_clotheshop:pay') AddEventHandler('esx_clotheshop:pay', function() - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) + local xPlayer = ESX.GetPlayerFromId(_source) xPlayer.removeMoney(Config.Price) - - TriggerClientEvent('esx:showNotification', source, _U('you_paid') .. Config.Price) - + TriggerClientEvent('esx:showNotification', _source, _U('you_paid', Config.Price)) end) RegisterServerEvent('esx_clotheshop:saveOutfit') AddEventHandler('esx_clotheshop:saveOutfit', function(label, skin) - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) + local xPlayer = ESX.GetPlayerFromId(_source) + TriggerEvent('esx_datastore:getDataStore', 'property', xPlayer.identifier, function(store) local dressing = store.get('dressing') @@ -35,25 +32,15 @@ AddEventHandler('esx_clotheshop:saveOutfit', function(label, skin) store.set('dressing', dressing) end) - end) ESX.RegisterServerCallback('esx_clotheshop:checkMoney', function(source, cb) - - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) - if xPlayer.get('money') >= Config.Price then - cb(true) - else - cb(false) - end - + local xPlayer = ESX.GetPlayerFromId(source) + cb(xPlayer.get('money') >= Config.Price) end) ESX.RegisterServerCallback('esx_clotheshop:checkPropertyDataStore', function(source, cb) - - local _source = source - local xPlayer = ESX.GetPlayerFromId(_source) + local xPlayer = ESX.GetPlayerFromId(source) local foundStore = false TriggerEvent('esx_datastore:getDataStore', 'property', xPlayer.identifier, function(store) @@ -61,5 +48,4 @@ ESX.RegisterServerCallback('esx_clotheshop:checkPropertyDataStore', function(sou end) cb(foundStore) - end)