refactor: ESX Shops - ReadMe, TextUI, better blips and markers!

This commit is contained in:
Mycroft
2022-07-16 16:36:31 +01:00
parent 12dfcced05
commit fc00c4e1ca
4 changed files with 22 additions and 43 deletions
+5 -28
View File
@@ -1,33 +1,10 @@
# esx_shops
<h1 align='center'>[ESX] Shops</a></h1><p align='center'><b><a href='https://discord.esx-framework.org/'>Discord</a> - <a href='https://esx-framework.org/'>Website</a> - <a href='https://docs.esx-framework.org/legacy/installation'>Documentation</a></b></h5>
## Download & Installation
### Using [fvm](https://github.com/qlaffont/fvm-installer)
```
fvm install --save --folder=esx esx-org/esx_shops
```
### Using Git
```
cd resources
git clone https://github.com/ESX-Org/esx_shops [esx]/esx_shops
```
### Manually
- Download https://github.com/ESX-Org/esx_shops/archive/master.zip
- Put it in the `[esx]` directory
## Installation
- Import `esx_shops.sql` to your database
- Add this in your `server.cfg`:
```
start esx_shops
```
This Resource allows Players to shop til they Drop! You Configure *everything* within the Config.lua, and dont worry about those pesky cheaters, we have Security Steve on the door to protect you and your city!
# Legal
### License
esx_shops - shoppin'
esx_shops - shop til you drop!
Copyright (C) 2015-2022 Jérémie N'gadi
@@ -35,4 +12,4 @@ This program Is free software: you can redistribute it And/Or modify it under th
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/.
You should have received a copy Of the GNU General Public License along with this program. If Not, see <http://www.gnu.org/licenses/>.
+7 -5
View File
@@ -24,12 +24,12 @@ function OpenShopMenu(zone)
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'shop', {
title = _U('shop'),
align = 'bottom-right',
align = 'bottom-left',
elements = elements
}, function(data, menu)
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'shop_confirm', {
title = _U('shop_confirm', data.current.value, data.current.itemLabel, ESX.Math.GroupDigits(data.current.price * data.current.value)),
align = 'bottom-right',
align = 'bottom-left',
elements = {
{label = _U('no'), value = 'no'},
{label = _U('yes'), value = 'yes'}
@@ -89,16 +89,16 @@ CreateThread(function()
if currentAction then
Sleep = 0
ESX.ShowHelpNotification(currentActionMsg)
if IsControlJustReleased(0, 38) and currentAction == 'shop_menu' then
currentAction = nil
ESX.HideUI()
OpenShopMenu(currentActionData.zone)
end
end
local playerCoords = GetEntityCoords(PlayerPedId())
local isInMarker, currentZone = false
local isInMarker, currentZone = false, nil
for k,v in pairs(Config.Zones) do
for i = 1, #v.Pos, 1 do
@@ -107,7 +107,7 @@ CreateThread(function()
if distance < Config.DrawDistance then
Sleep = 0
if v.ShowMarker then
DrawMarker(Config.MarkerType, v.Pos[i], 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Config.MarkerSize.x, Config.MarkerSize.y, Config.MarkerSize.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, nil, nil, false)
DrawMarker(Config.MarkerType, v.Pos[i], 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Config.MarkerSize.x, Config.MarkerSize.y, Config.MarkerSize.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, nil, nil, false)
end
if distance < 2.0 then
isInMarker = true
@@ -120,11 +120,13 @@ CreateThread(function()
if isInMarker and not hasAlreadyEnteredMarker then
hasAlreadyEnteredMarker = true
ESX.TextUI(currentActionMsg)
TriggerEvent('esx_shops:hasEnteredMarker', currentZone)
end
if not isInMarker and hasAlreadyEnteredMarker then
hasAlreadyEnteredMarker = false
ESX.HideUI()
TriggerEvent('esx_shops:hasExitedMarker', lastZone)
end
Wait(Sleep)
+6 -6
View File
@@ -1,8 +1,8 @@
Config = {}
Config.DrawDistance = 10
Config.MarkerSize = {x = 1.1, y = 1.1, z = 0.9}
Config.DrawDistance = 7.5
Config.MarkerSize = {x = 1.1, y = 0.7, z = 1.1}
Config.MarkerType = 29
Config.MarkerColor = {r = 102, g = 102, b = 204, a = 255}
Config.MarkerColor = {r = 50, g = 200, b = 50, a = 200}
Config.Locale = 'en'
Config.Zones = {
@@ -30,7 +30,7 @@ Config.Zones = {
vector3(2678.9, 3280.6, 55.2),
vector3(1729.2, 6414.1, 35.0)
},
Size = 1.0,
Size = 0.8,
Type = 59,
Color = 25,
ShowBlip = true,
@@ -61,7 +61,7 @@ Config.Zones = {
vector3(-1393.4, -606.6, 30.3), --Tequila la
vector3(-559.9, 287.0, 82.1) --Bahamamas
},
Size = 1.0,
Size = 0.8,
Type = 59,
Color = 25,
ShowBlip = true,
@@ -88,7 +88,7 @@ Config.Zones = {
vector3(-1820.5, 792.5, 138.1),
vector3(1698.3, 4924.4, 42.0)
},
Size = 1.0,
Size = 0.8,
Type = 59,
Color = 25,
ShowBlip = true,
+4 -4
View File
@@ -1,11 +1,11 @@
Locales['en'] = {
['shop'] = 'shop',
['shops'] = 'shops',
['press_menu'] = 'press [E] to access the store.',
['press_menu'] = 'press [E] to access the ~g~store.',
['shop_item'] = '$%s',
['bought'] = 'you just bought %sx %s for ~r~$%s',
['not_enough'] = 'you do not have ~r~enough money, you\'re missing ~r~$%s!',
['player_cannot_hold'] = 'you do ~r~not have enough free space in your inventory!',
['bought'] = 'You Have Bought ~b~%sx %s~s~ for ~b~$%s',
['not_enough'] = 'you do ~r~not~s~ have enough money, you\'re missing ~b~$%s!',
['player_cannot_hold'] = 'you do ~r~not~s~ have enough free space in your inventory!',
['shop_confirm'] = 'buy %sx %s for $%s?',
['no'] = 'no',
['yes'] = 'yes',