-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(esx_shops): ✨ Add support for multiple paymenth methods, revert … #26
base: dev
Are you sure you want to change the base?
Conversation
…to esx_menu_default, migrate esx_shops to ESX Point system.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add type annotations, please.
client/main.lua
Outdated
local function hasExitedMarker(zone) | ||
currentAction = nil | ||
ESX.CloseContext() | ||
function createShopPoint(pos, zone, ShowMarker) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please be consistent with variable naming. Why is ShowMarker capitalized?
client/main.lua
Outdated
local hasAlreadyEnteredMarker, lastZone | ||
local currentAction, currentActionMsg, currentActionData = nil, nil, {} | ||
|
||
local currentZone, TextUI, inMenu |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please be consistent with variable naming. Why is TextUI capitalized?
client/main.lua
Outdated
value = 1, | ||
type = "slider", | ||
min = 1, | ||
max = 10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be a good idea to add min
and max
as optionals to the config.
@@ -1,53 +1,52 @@ | |||
function GetItemFromShop(itemName, zone) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should explicitly return false when item is not found.
|
||
return true,item.price, item.label | ||
function PlayerPosCheck(playerCoords, zone) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should explicitly return false if pos check fails
config.lua
Outdated
Config.Locale = GetConvar('esx:locale', 'en') | ||
|
||
Config.Zones = { | ||
-- Accounts that can be used for paymenth | ||
Config.PaymenthAccounts = {"money", "bank"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix typo "Paymenth"
end | ||
end | ||
|
||
local missingMoney = price - xPlayer.getMoney() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be hardcoded. Get one of the configured accounts with the highest amount in it
return print(('[^3WARNING^7] Player ^5%s^7 attempted to exploit the shop!'):format(source)) | ||
end | ||
|
||
if amount < 0 or not PlayerPosCheck(xPlayer.getCoords(true), zone) then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be amount <= 0
if account.money >= price then | ||
xPlayer.removeAccountMoney(account.name, price, ("%s %s"):format(name, TranslateCap('purchase'))) | ||
xPlayer.addInventoryItem(name, amount) | ||
return xPlayer.showNotification(TranslateCap('bought', amount, name, ESX.Math.GroupDigits(price))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Display item label to the user, not item name
…to esx_menu_default, migrate esx_shops to ESX Point system.