Pontes
As pontes fazem os scripts que já existem no seu servidor mostrarem a notificação e o progresso da gui_interface, sem trocar cada chamada.
| Ponte | Responde por |
|---|---|
Config.pontes.vrp | eventos Notify, itensNotify, progress e a taskbar vrp_taskbar |
Config.pontes.esx | esx_notify e esx_progressbar |
Config.pontes.qbcore | recurso progressbar |
Config.pontes.mythic | mythic_notify |
Config.pontes.okok | okokNotify |
vRP
Nada a fazer. Com Config.pontes.vrp = true (padrão) já funcionam:
TriggerClientEvent("Notify", source, "sucesso", "Texto", 5000)
TriggerClientEvent("itensNotify", source, "Recebeu", "water", 2)
TriggerClientEvent("progress", source, 10000, "Texto")A taskbar antiga vrp_taskbar (vTASKBAR.taskThree(source) e as outras) também.
ESX
Notificação e progresso
Escolha um jeito.
Jeito A, sem mexer no ESX:
- No
server.cfg, tireensure esx_notifyeensure esx_progressbar. Deixe as pastas onde estão. - No
fxmanifest.luada gui_interface, tire o--destas linhas:gui_interface/fxmanifest.luaprovide "esx_notify" provide "esx_progressbar" - No
config.lua:Config.pontes.esx = true. - Coloque
ensure gui_interfaceantes deensure es_extended.
Se aparecer Resource esx_notify is Missing no F8, use o jeito B.
Jeito B, uma linha no ESX. Arquivo es_extended/client/modules/ui/notifications.lua (ESX antigo: es_extended/client/functions.lua). Deixe Config.pontes.esx = false.
Primeira linha dentro de function ESX.ShowNotification(...):
if GetResourceState("gui_interface") == "started" then return exports.gui_interface:EsxNotify(notifyType, length, message, title) endPrimeira linha dentro de function ESX.Progressbar(...):
if GetResourceState("gui_interface") == "started" then return exports.gui_interface:EsxProgress(message, length, options) endPrimeira linha dentro de function ESX.CancelProgressbar():
if GetResourceState("gui_interface") == "started" then return exports.gui_interface:PararProgresso() endIsso cobre ESX.ShowNotification, xPlayer.showNotification, esx:showNotification e ESX.Progressbar.
Itens
Automático com o inventário padrão do ESX e com ox_inventory (Config.itens.automatico = true).
QBCore
Notificação
Arquivo qb-core/client/functions.lua, primeira linha dentro de function QBCore.Functions.Notify(text, texttype, length, icon):
if GetResourceState("gui_interface") == "started" then return exports.gui_interface:QBNotify(text, texttype, length) endCobre QBCore.Functions.Notify e TriggerClientEvent("QBCore:Notify", ...).
Progresso
Escolha um jeito.
Jeito A, uma linha no recurso progressbar. Arquivo progressbar/client.lua, primeira linha dentro de local function StartProgress(action, onStart, onTick, onFinish):
if GetResourceState("gui_interface") == "started" then return exports.gui_interface:QBProgress(action, onFinish, onStart, onTick) endCobre QBCore.Functions.Progressbar, todos os exports do progressbar e o evento progressbar:client:cancel.
Jeito B, sem mexer:
- No
server.cfg, tireensure progressbar. - No
fxmanifest.luada gui_interface, tire o--deprovide "progressbar". Config.pontes.qbcore = true.
Se aparecer progressbar needs to be started, use o jeito A.
Itens
Automático com qb-inventory, ps-inventory, lj-inventory e ox_inventory.
O qb-inventory continua mostrando a caixa dele quando um script dispara qb-inventory:client:ItemBox. Para mostrar só a nossa, apague o conteúdo desse evento no qb-inventory/client/main.lua.
QBox e ox_lib
O QBox usa o ox_lib para notificação e progresso. Mexa só no ox_lib.
Arquivo ox_lib/resource/interface/client/notify.lua, primeira linha dentro de function lib.notify(data):
if GetResourceState("gui_interface") == "started" then return exports.gui_interface:OxNotify(data) endArquivo ox_lib/resource/interface/client/progress.lua, primeira linha dentro de function lib.progressBar(data) e de function lib.progressCircle(data):
if GetResourceState("gui_interface") == "started" then return exports.gui_interface:OxProgress(data) endNo mesmo arquivo, primeira linha de function lib.progressActive():
if GetResourceState("gui_interface") == "started" and exports.gui_interface:ProgressoAtivo() then return true endE primeira linha de function lib.cancelProgress():
if GetResourceState("gui_interface") == "started" and exports.gui_interface:ProgressoAtivo() then return exports.gui_interface:PararProgresso() endCobre lib.notify, exports.qbx_core:Notify, TriggerClientEvent("ox_lib:notify", ...), lib.progressBar e lib.progressCircle.
Itens: automático com ox_inventory.
mythic_notify e okokNotify
- No
server.cfg, tireensure mythic_notify(ouensure okokNotify). - No
fxmanifest.lua, tire o--deprovide "mythic_notify"(ouprovide "okokNotify"). Config.pontes.mythic = true(ouConfig.pontes.okok = true).
Os scripts que chamam exports["mythic_notify"]:DoHudText(...), mythic_notify:client:SendAlert, exports["okokNotify"]:Alert(...) ou okokNotify:Alert passam a mostrar a nossa notificação.
Outro script com notificação própria
Troque a chamada dele:
-- antes
exports["meu_notify"]:Show("Texto", "success")
-- depois
exports.gui_interface:Notificar("success", "Texto")Atualizar o ESX, qb-core, progressbar ou ox_lib apaga as linhas acima. Coloque de novo depois de cada atualização.