mirror of
https://github.com/jimathy/jim-payments.git
synced 2026-08-18 06:46:02 +01:00
Add files via upload
This commit is contained in:
@@ -1,23 +1,27 @@
|
||||
RegisterNetEvent(getScript()..":Tickets:Menu", function(data)
|
||||
local PlayerInfo = getPlayer()
|
||||
local hasItem, hasTable = hasItem("payticket", 1)
|
||||
if not hasItem then
|
||||
triggerNotify(nil, Loc[Config.Lan].error["no_ticket"], "error")
|
||||
triggerNotify(nil, locale("error" ,"no_ticket"), "error")
|
||||
return
|
||||
end
|
||||
local amount, sellable, name, label = hasTable["payticket"].count, false, "", ""
|
||||
for k, v in pairs(Config.Receipts.Jobs) do
|
||||
sellable = (data.gang and v.gang and k == PlayerGang.name) or (not data.gang and not v.gang and k == PlayerJob.name)
|
||||
if sellable then name, label = k, (data.gang and PlayerGang.label) or (not data.gang and PlayerJob.label) break end
|
||||
sellable = (data.gang and v.gang and k == PlayerInfo.gang) or (not data.gang and not v.gang and k == PlayerInfo.job)
|
||||
if sellable then name, label = k, (data.gang and Gangs[PlayerInfo.gang].label) or (not data.gang and Jobs[PlayerInfo.job].label) break end
|
||||
end
|
||||
if sellable then local Menu = {}
|
||||
Menu[#Menu+1] = {
|
||||
isMenuHeader = true,
|
||||
txt = Loc[Config.Lan].menu["ticket_amount"]..amount..Loc[Config.Lan].menu["total_pay"]..(Config.Receipts.Jobs[name].PayPerTicket * amount)
|
||||
txt = locale("menu" ,"ticket_amount")..amount..locale("menu" ,"total_pay")..(Config.Receipts.Jobs[name].PayPerTicket * amount)
|
||||
}
|
||||
Menu[#Menu+1] = {
|
||||
icon = "fas fa-circle-check", header = Loc[Config.Lan].menu["yes"],
|
||||
onSelect = function() TriggerServerEvent(getScript()..":Tickets:Sell") end,
|
||||
icon = "fas fa-circle-check", header = locale("menu" ,"yes"),
|
||||
onSelect = function()
|
||||
TriggerServerEvent(getScript()..":Tickets:Sell")
|
||||
playAnim("pickup_object", "putdown_low", 2000, 1)
|
||||
end,
|
||||
}
|
||||
openMenu(Menu, { header = "🧾 "..label..Loc[Config.Lan].menu["receipt"], headertxt = Loc[Config.Lan].menu["trade_confirm"], canClose = true, })
|
||||
openMenu(Menu, { header = "🧾 "..label..locale("menu" ,"receipt"), headertxt = locale("menu" ,"trade_confirm"), canClose = true, })
|
||||
end
|
||||
end)
|
||||
Reference in New Issue
Block a user