structura foldere
mutat kq- folders in un singur folder [kq]
This commit is contained in:
+235
@@ -0,0 +1,235 @@
|
||||
if Config.Menu ~= 'nh-context' then
|
||||
return
|
||||
end
|
||||
|
||||
function openRecipeMenu()
|
||||
TriggerServerCallback('phone:CheckExistRecipe', function(exist)
|
||||
local method = exist?.method or ''
|
||||
local moment_header = ([[
|
||||
Moment %s
|
||||
]]):format(method == 'moment' and '<span style="color:green; margin-left: 4px"> - ' .. Lang('PHONE_MENU_RECIPES_OPTION_CURRENTLY') .. exist?.amount .. '</span>' or '')
|
||||
local daily_header = ([[
|
||||
Daily %s
|
||||
]]):format(method == 'daily' and ' - ' .. Lang('PHONE_MENU_RECIPES_OPTION_CURRENTLY') or '')
|
||||
local data = {
|
||||
{
|
||||
header = Lang('PHONE_MENU_RECIPES_TITLE'),
|
||||
},
|
||||
{
|
||||
header = daily_header,
|
||||
context = Lang('PHONE_MENU_RECIPES_UPDATED'),
|
||||
event = 'phone:recipeSelectMethod',
|
||||
args = { 'daily' }
|
||||
},
|
||||
{
|
||||
header = moment_header,
|
||||
context = Lang('PHONE_MENU_RECIPES_CONTOUR'),
|
||||
event = 'phone:recipeSelectMethod',
|
||||
args = { 'moment' }
|
||||
},
|
||||
}
|
||||
if exist then
|
||||
table.insert(data, {
|
||||
header = "<span style='color: gray'>" .. Lang('PHONE_MENU_RECIPES_OPTION_CANCEL') .. '</span>',
|
||||
context = Lang('PHONE_MENU_RECIPES_CANCEL'),
|
||||
event = 'phone:CancelRecipe',
|
||||
server = true,
|
||||
args = {}
|
||||
})
|
||||
end
|
||||
TriggerEvent('nh-context:createMenu', data)
|
||||
end)
|
||||
end
|
||||
|
||||
function openPhoneBoothMenu(isNearPB)
|
||||
local data = {
|
||||
{
|
||||
header = Lang('PHONE_MENU_BOOTH_CALL_TITLE'),
|
||||
},
|
||||
{
|
||||
header = Lang('PHONE_MENU_BOOTH_CALL_POLICE'),
|
||||
context = 'police',
|
||||
event = 'phone:boothCall',
|
||||
args = { 'police' }
|
||||
},
|
||||
{
|
||||
header = Lang('PHONE_MENU_BOOTH_CALL_AMBULANCE'),
|
||||
context = 'ambulance',
|
||||
event = 'phone:boothCall',
|
||||
args = { 'ambulance' }
|
||||
},
|
||||
{
|
||||
header = Lang('PHONE_MENU_BOOTH_CALL_MECHANIC'),
|
||||
context = 'mechanic',
|
||||
event = 'phone:boothCall',
|
||||
args = { 'mechanic' }
|
||||
},
|
||||
{
|
||||
header = Lang('PHONE_MENU_BOOTH_CALL_NUMBER'),
|
||||
context = 'othercall',
|
||||
event = 'phone:boothCall',
|
||||
args = { 'othercall' }
|
||||
}
|
||||
}
|
||||
|
||||
TriggerEvent('nh-context:createMenu', data)
|
||||
end
|
||||
|
||||
function openRentalMenu(key)
|
||||
local data = {
|
||||
{
|
||||
header = Lang('PHONE_MENU_RENTEL_TITLE')
|
||||
}
|
||||
}
|
||||
local coords = { x = Config.RentelLocations[key]['coords'].x, y = Config.RentelLocations[key]['coords'].y, z = Config.RentelLocations[key]['coords'].z, h = Config.RentelLocations[key]['coords'].w }
|
||||
for model, v in pairs(Config.RentelVehicles) do
|
||||
if v.stored then
|
||||
table.insert(data, {
|
||||
header = v.label .. ' - ' .. Lang('PHONE_MENU_RENTEL_STORED'),
|
||||
context = 'Rentel',
|
||||
event = 'phone:server:spawnVehicle',
|
||||
server = true,
|
||||
args = { {
|
||||
model = model, price = 0, coords = coords
|
||||
} }
|
||||
})
|
||||
else
|
||||
table.insert(data, {
|
||||
header = v.label .. ' - ' .. Lang('PHONE_MENU_RENTEL_MONEY') .. v.price,
|
||||
context = 'Rentel',
|
||||
event = 'phone:server:spawnVehicle',
|
||||
server = true,
|
||||
args = { {
|
||||
model = model, price = v.price, coords = coords
|
||||
} }
|
||||
})
|
||||
end
|
||||
end
|
||||
TriggerEvent('nh-context:createMenu', data)
|
||||
end
|
||||
|
||||
function resetPasswordMenu()
|
||||
local data = {
|
||||
{
|
||||
header = Lang('PHONE_MENU_PHONE_TITLE')
|
||||
},
|
||||
{
|
||||
header = Lang('PHONE_MENU_PHONE_RESET_PASSWORD') .. Config.ResetPassword.money,
|
||||
context = 'Reset Password',
|
||||
event = 'phone:ResetPassword'
|
||||
}
|
||||
}
|
||||
TriggerEvent('nh-context:createMenu', data)
|
||||
end
|
||||
|
||||
RegisterNetEvent('phone:openPhoneMenu', function(event, ...)
|
||||
local items = GetInventory()
|
||||
local data = {
|
||||
{
|
||||
header = Lang('PHONE_MENU_BATTERY_TITLE')
|
||||
}
|
||||
}
|
||||
if not Config.UniquePhone then
|
||||
local userData = TriggerServerCallbackSync('phone:getUserData')
|
||||
if not userData then
|
||||
Debug('phone', 'userData is nil')
|
||||
return
|
||||
end
|
||||
table.insert(data, {
|
||||
header = Lang('PHONE_MENU_BATTERY_PHONE_NUMBER') .. ' ' .. userData.phoneNumber,
|
||||
context = 'Phone',
|
||||
event = 'phone:selectPhone',
|
||||
args = { { name = 'phone', info = { phoneNumber = userData.phoneNumber } }, event, ... }
|
||||
})
|
||||
end
|
||||
if Config.UniquePhone then
|
||||
for phoneName in pairs(Config.Phones) do
|
||||
for k, v in pairs(items) do
|
||||
local meta = v.info or v.metadata
|
||||
if v.name == phoneName and meta?.phoneNumber then
|
||||
table.insert(data, {
|
||||
header = Lang('PHONE_MENU_BATTERY_PHONE_NUMBER') .. ' ' .. meta.phoneNumber,
|
||||
context = 'Phone',
|
||||
event = 'phone:selectPhone',
|
||||
args = { v, event, ... }
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if #data < 2 then return SendTextMessage(Lang('PHONE_NOTIFICATION_PHONE_NO_PHONE'), 'error') end
|
||||
TriggerEvent('nh-context:createMenu', data)
|
||||
end)
|
||||
|
||||
RegisterNetEvent('phone:client:openChannelMenu', function()
|
||||
if not MetaData then return SendTextMessage(Lang('PHONE_NOTIFICATION_RECIPES_USE_PHONE_FIRST'), 'inform') end
|
||||
local input = lib.inputDialog(Lang('PHONE_MENU_DISCORD_CHANNEL_TITLE'), {
|
||||
Lang('PHONE_MENU_DISCORD_SELECT_NAME'),
|
||||
Lang('PHONE_MENU_DISCORD_SELECT_PASSWORD')
|
||||
})
|
||||
if not input then return end
|
||||
local channelName = input[1]
|
||||
local passcode = input[2]
|
||||
|
||||
Debug('phone', 'channelName', channelName, 'passcode', passcode)
|
||||
|
||||
local roomData = {
|
||||
room_owner_name = MetaData.charinfo.firstname .. ' ' .. MetaData.charinfo.lastname
|
||||
}
|
||||
|
||||
local allGood = false
|
||||
|
||||
if channelName then
|
||||
roomData.room_name = channelName
|
||||
allGood = true
|
||||
end
|
||||
|
||||
if passcode then
|
||||
roomData.room_pin = passcode
|
||||
end
|
||||
|
||||
if allGood then
|
||||
TriggerServerCallback('phone:server:PurchaseRoom', function(status)
|
||||
if status then
|
||||
local source = GetPlayerServerId(PlayerId())
|
||||
TriggerServerEvent('phone:server:CreateRoom', source, roomData)
|
||||
end
|
||||
end, 250)
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent('phone:client:openChannelHackedMenu', function()
|
||||
if not MetaData then return SendTextMessage(Lang('PHONE_NOTIFICATION_RECIPES_USE_PHONE_FIRST'), 'inform') end
|
||||
|
||||
local keyboard, channelName, passcode = exports['nh-keyboard']:Keyboard({
|
||||
header = Lang('PHONE_MENU_DISCORD_SECURE_TITLE'),
|
||||
rows = { Lang('PHONE_MENU_DISCORD_SELECT_NAME'), Lang('PHONE_MENU_DISCORD_SELECT_PASSWORD') }
|
||||
})
|
||||
|
||||
if keyboard then
|
||||
local roomData = {
|
||||
room_owner_name = MetaData.charinfo.firstname .. ' ' .. MetaData.charinfo.lastname
|
||||
}
|
||||
|
||||
local allGood = false
|
||||
|
||||
if channelName then
|
||||
roomData.room_name = channelName
|
||||
allGood = true
|
||||
end
|
||||
|
||||
if passcode then
|
||||
roomData.room_pin = passcode
|
||||
end
|
||||
|
||||
if allGood then
|
||||
TriggerServerCallback('phone:server:PurchaseRoom', function(status)
|
||||
if status then
|
||||
local source = GetPlayerServerId(PlayerId())
|
||||
TriggerServerEvent('phone:server:CreateRoom', source, roomData, true)
|
||||
end
|
||||
end, 5000)
|
||||
end
|
||||
end
|
||||
end)
|
||||
+239
@@ -0,0 +1,239 @@
|
||||
if Config.Menu ~= 'ox_lib' then
|
||||
return
|
||||
end
|
||||
|
||||
function openRecipeMenu()
|
||||
TriggerServerCallback('phone:CheckExistRecipe', function(recipe)
|
||||
print(json.encode(recipe))
|
||||
local method = recipe and recipe.method or ''
|
||||
local isMoment = method == 'moment'
|
||||
local isDaily = method == 'daily'
|
||||
|
||||
local momentHeader = isMoment and (' - ' .. Lang('PHONE_MENU_RECIPES_OPTION_CURRENTLY') .. " " .. recipe.amount) or ''
|
||||
local dailyHeader = isDaily and (' - ' .. Lang('PHONE_MENU_RECIPES_OPTION_CURRENTLY') .. " " .. recipe.amount) or ''
|
||||
|
||||
local options = {
|
||||
{
|
||||
title = ("%s $%s"):format(Lang('PHONE_MENU_RECIPES_UPDATED'), Config.BuyRecipe.prices["daily"]),
|
||||
description = dailyHeader,
|
||||
onSelect = function()
|
||||
TriggerEvent('phone:recipeSelectMethod', 'daily')
|
||||
end
|
||||
},
|
||||
{
|
||||
title = ("%s $%s"):format(Lang('PHONE_MENU_RECIPES_CONTOUR'), Config.BuyRecipe.prices["moment"]),
|
||||
description = momentHeader,
|
||||
onSelect = function()
|
||||
TriggerEvent('phone:recipeSelectMethod', 'moment')
|
||||
end
|
||||
}
|
||||
}
|
||||
|
||||
if recipe then
|
||||
table.insert(options, {
|
||||
title = Lang('PHONE_MENU_RECIPES_CANCEL'),
|
||||
onSelect = function()
|
||||
TriggerServerEvent('phone:CancelRecipe')
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
lib.registerContext({
|
||||
id = 'recipe_spot',
|
||||
title = Lang('PHONE_MENU_RECIPES_TITLE'),
|
||||
options = options
|
||||
})
|
||||
|
||||
lib.showContext('recipe_spot')
|
||||
end)
|
||||
end
|
||||
|
||||
function openPhoneBoothMenu(isNearPB)
|
||||
local data = {
|
||||
{
|
||||
title = Lang('PHONE_MENU_BOOTH_CALL_POLICE'),
|
||||
onSelect = function(args)
|
||||
TriggerEvent('phone:boothCall', 'police')
|
||||
end
|
||||
},
|
||||
{
|
||||
title = Lang('PHONE_MENU_BOOTH_CALL_AMBULANCE'),
|
||||
onSelect = function(args)
|
||||
TriggerEvent('phone:boothCall', 'police')
|
||||
end
|
||||
},
|
||||
{
|
||||
title = Lang('PHONE_MENU_BOOTH_CALL_MECHANIC'),
|
||||
onSelect = function(args)
|
||||
TriggerEvent('phone:boothCall', 'police')
|
||||
end
|
||||
},
|
||||
{
|
||||
title = Lang('PHONE_MENU_BOOTH_CALL_NUMBER'),
|
||||
onSelect = function(args)
|
||||
TriggerEvent('phone:boothCall', 'othercall')
|
||||
end
|
||||
},
|
||||
}
|
||||
lib.registerContext({
|
||||
id = 'phone_booth',
|
||||
title = Lang('PHONE_MENU_BOOTH_CALL_TITLE'),
|
||||
options = data
|
||||
})
|
||||
lib.showContext('phone_booth')
|
||||
end
|
||||
|
||||
function openRentalMenu(key)
|
||||
local coords = { x = Config.RentelLocations[key]['coords'].x, y = Config.RentelLocations[key]['coords'].y, z = Config.RentelLocations[key]['coords'].z, h = Config.RentelLocations[key]['coords'].w }
|
||||
local data = {}
|
||||
for model, v in pairs(Config.RentelVehicles) do
|
||||
if v.stored then
|
||||
table.insert(data, {
|
||||
title = v.label .. ' - ' .. Lang('PHONE_MENU_RENTEL_STORED'),
|
||||
onSelect = function(args)
|
||||
TriggerServerEvent('phone:server:spawnVehicle', { model = model, price = 0, coords = coords })
|
||||
end
|
||||
})
|
||||
else
|
||||
table.insert(data, {
|
||||
title = v.label .. ' - ' .. Lang('PHONE_MENU_RENTEL_MONEY') .. v.price,
|
||||
onSelect = function(args)
|
||||
TriggerServerEvent('phone:server:spawnVehicle', { model = model, price = v.price, coords = coords })
|
||||
end
|
||||
})
|
||||
end
|
||||
end
|
||||
lib.registerContext({
|
||||
id = 'rentel_spot',
|
||||
title = Lang('PHONE_MENU_RENTEL_TITLE'),
|
||||
options = data
|
||||
})
|
||||
lib.showContext('rentel_spot')
|
||||
end
|
||||
|
||||
function resetPasswordMenu()
|
||||
local data = {
|
||||
{
|
||||
title = Lang('PHONE_MENU_PHONE_RESET_PASSWORD') .. Config.ResetPassword.money,
|
||||
onSelect = function(args)
|
||||
TriggerEvent('phone:ResetPassword')
|
||||
end
|
||||
}
|
||||
}
|
||||
lib.registerContext({
|
||||
id = 'reset_password',
|
||||
title = Lang('PHONE_MENU_PHONE_TITLE'),
|
||||
options = data
|
||||
})
|
||||
lib.showContext('reset_password')
|
||||
end
|
||||
|
||||
RegisterNetEvent('phone:openPhoneMenu', function(event, ...)
|
||||
local items = GetInventory()
|
||||
local data = {}
|
||||
local varargs = { ... }
|
||||
if not Config.UniquePhone then
|
||||
local userData = TriggerServerCallbackSync('phone:getUserData')
|
||||
if userData then
|
||||
table.insert(data, {
|
||||
title = Lang('PHONE_MENU_BATTERY_PHONE_NUMBER') .. ' ' .. userData.phoneNumber,
|
||||
onSelect = function(args)
|
||||
TriggerServerEvent(event, {
|
||||
name = 'phone',
|
||||
info = { phoneNumber = userData.phoneNumber }
|
||||
}, table.unpack(varargs))
|
||||
end,
|
||||
})
|
||||
end
|
||||
else
|
||||
for phoneName in pairs(Config.Phones) do
|
||||
for k, v in pairs(items) do
|
||||
local meta = v.info or v.metadata
|
||||
if v.name == phoneName and meta?.phoneNumber then
|
||||
table.insert(data, {
|
||||
title = Lang('PHONE_MENU_BATTERY_PHONE_NUMBER') .. ' ' .. meta.phoneNumber,
|
||||
onSelect = function(args)
|
||||
TriggerServerEvent(event, v, table.unpack(varargs))
|
||||
end,
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if #data < 1 then return SendTextMessage(Lang('PHONE_NOTIFICATION_PHONE_NO_PHONE'), 'error') end
|
||||
lib.registerContext({
|
||||
id = 'charger_spot',
|
||||
title = Lang('PHONE_MENU_BATTERY_TITLE'),
|
||||
options = data
|
||||
})
|
||||
lib.showContext('charger_spot')
|
||||
end)
|
||||
|
||||
RegisterNetEvent('phone:client:openChannelMenu', function()
|
||||
if not MetaData then return SendTextMessage(Lang('PHONE_NOTIFICATION_RECIPES_USE_PHONE_FIRST'), 'inform') end
|
||||
local input = lib.inputDialog(Lang('PHONE_MENU_DISCORD_CHANNEL_TITLE'), {
|
||||
{ type = 'input', label = Lang('PHONE_MENU_DISCORD_SELECT_NAME'), description = Lang('PHONE_MENU_DISCORD_SELECT_NAME_INFO'), required = true },
|
||||
{ type = 'number', label = Lang('PHONE_MENU_DISCORD_SELECT_PASSWORD'), description = Lang('PHONE_MENU_DISCORD_SELECT_PASSWORD_INFO'), required = false },
|
||||
})
|
||||
|
||||
if input and input[1] then
|
||||
local roomData = {
|
||||
room_owner_name = MetaData.charinfo.firstname .. ' ' .. MetaData.charinfo.lastname
|
||||
}
|
||||
|
||||
local allGood = false
|
||||
|
||||
if input[1] then
|
||||
roomData.room_name = input[1]
|
||||
allGood = true
|
||||
end
|
||||
|
||||
if input[2] then
|
||||
roomData.room_pin = input[2]
|
||||
end
|
||||
|
||||
if allGood then
|
||||
TriggerServerCallback('phone:server:PurchaseRoom', function(status)
|
||||
if status then
|
||||
local source = GetPlayerServerId(PlayerId())
|
||||
TriggerServerEvent('phone:server:CreateRoom', source, roomData)
|
||||
end
|
||||
end, 250)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent('phone:client:openChannelHackedMenu', function()
|
||||
if not MetaData then return SendTextMessage(Lang('PHONE_NOTIFICATION_RECIPES_USE_PHONE_FIRST'), 'inform') end
|
||||
local input = lib.inputDialog(Lang('PHONE_MENU_DISCORD_SECURE_TITLE'), {
|
||||
{ type = 'input', label = Lang('PHONE_MENU_DISCORD_SELECT_NAME'), description = Lang('PHONE_MENU_DISCORD_SELECT_NAME_INFO'), required = true },
|
||||
{ type = 'number', label = Lang('PHONE_MENU_DISCORD_SELECT_PASSWORD'), description = Lang('PHONE_MENU_DISCORD_SELECT_PASSWORD_INFO'), required = false },
|
||||
})
|
||||
|
||||
if input and input[1] then
|
||||
local roomData = {
|
||||
room_owner_name = MetaData.charinfo.firstname .. ' ' .. MetaData.charinfo.lastname
|
||||
}
|
||||
|
||||
local allGood = false
|
||||
|
||||
if input[1] then
|
||||
roomData.room_name = input[1]
|
||||
allGood = true
|
||||
end
|
||||
|
||||
if input[2] then
|
||||
roomData.room_pin = input[2]
|
||||
end
|
||||
|
||||
if allGood then
|
||||
TriggerServerCallback('phone:server:PurchaseRoom', function(status)
|
||||
if status then
|
||||
local source = GetPlayerServerId(PlayerId())
|
||||
TriggerServerEvent('phone:server:CreateRoom', source, roomData, true)
|
||||
end
|
||||
end, 250)
|
||||
end
|
||||
end
|
||||
end)
|
||||
Reference in New Issue
Block a user