mirror of
https://github.com/jimathy/jim_bridge.git
synced 2026-08-19 14:56:02 +01:00
Fix change dui functions
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
if gameName ~= "rdr3" then
|
if gameName ~= "rdr3" then
|
||||||
--[[
|
--[[
|
||||||
DUI Module (Experimental)
|
DUI Module (Experimental)
|
||||||
--------------------------
|
--------------------------
|
||||||
This module handles the creation, modification, and removal of custom DUI (Display UI)
|
This module handles the creation, modification, and removal of custom DUI (Display UI)
|
||||||
@@ -50,21 +50,17 @@ if gameName ~= "rdr3" then
|
|||||||
--- DuiSelect({ name = "logo", texn = "logoTex", texd = "someTxd", size = { x = 512, y = 256 } })
|
--- DuiSelect({ name = "logo", texn = "logoTex", texd = "someTxd", size = { x = 512, y = 256 } })
|
||||||
--- ```
|
--- ```
|
||||||
function DuiSelect(data)
|
function DuiSelect(data)
|
||||||
local imagePreview = ""
|
local imagePreview = ""
|
||||||
for k, v in pairs(duiList[data.name]) do
|
--local imagePreview = "<center>- Current Image -<br>" ..
|
||||||
if v.tex.texn == data.texn and duiList[data.name][k] then
|
-- "<img src="..data.url.." width=150px><br>" ..
|
||||||
imagePreview = "<center>- Current Image -<br>" ..
|
-- "Size: ["..math.floor(data.size.x)..", "..math.floor(data.size.y).."]<br><br>"
|
||||||
"<img src="..duiList[data.name][k].url.." width=150px><br>" ..
|
|
||||||
"Size: ["..math.floor(data.size.x)..", "..math.floor(data.size.y).."]<br><br>"
|
local dialog = createInput(imagePreview, {
|
||||||
end
|
{ type = "text", text = "dui_url", name = "url", isRequired = true },
|
||||||
end
|
|
||||||
local dialog = exports['qb-input']:ShowInput({
|
|
||||||
header = imagePreview..Loc[Config.Lan].menu["dui_new"],
|
|
||||||
submitText = Loc[Config.Lan].menu["dui_change"],
|
|
||||||
inputs = { { type = 'text', isRequired = true, name = 'url', text = Loc[Config.Lan].menu["dui_url"] } }
|
|
||||||
})
|
})
|
||||||
if dialog and dialog.url then
|
|
||||||
data.url = dialog.url
|
if dialog then
|
||||||
|
data.url = dialog.url or dialog[1]
|
||||||
-- Scan URL for valid image extension and banned words.
|
-- Scan URL for valid image extension and banned words.
|
||||||
local searchList = { "png", "jpg", "jpeg", "gif", "webp", "bmp" }
|
local searchList = { "png", "jpg", "jpeg", "gif", "webp", "bmp" }
|
||||||
local banList = { "porn" }
|
local banList = { "porn" }
|
||||||
@@ -115,18 +111,15 @@ if gameName ~= "rdr3" then
|
|||||||
--- If no URL is provided, resets to the preset value.
|
--- If no URL is provided, resets to the preset value.
|
||||||
RegisterNetEvent(getScript()..":Server:ChangeDUI", function(data)
|
RegisterNetEvent(getScript()..":Server:ChangeDUI", function(data)
|
||||||
if not data.url then
|
if not data.url then
|
||||||
for k, v in pairs(duiList[data.name]) do
|
debugPrint("^6Bridge^7: ^2Preset: ^6"..tostring(data.preset).."^7")
|
||||||
|
data.url = data.preset
|
||||||
|
else
|
||||||
|
for k, v in pairs(Locations[data.name].duiList) do
|
||||||
if v.tex.texn == data.texn then
|
if v.tex.texn == data.texn then
|
||||||
debugPrint("^6Bridge^7: ^2Preset: ^6"..tostring(duiList[data.name][k].preset).."^7")
|
Locations[data.name].duiList[k].url = data.url
|
||||||
data.url = duiList[data.name][k].preset
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
for k, v in pairs(duiList[data.name]) do
|
|
||||||
if v.tex.texn == data.texn then
|
|
||||||
duiList[data.name][k].url = data.url
|
|
||||||
end
|
|
||||||
end
|
|
||||||
debugPrint("^6Bridge^7: ^3DUI^2 Sending new DUI to all players^7 - ^6"..data.url.."^7")
|
debugPrint("^6Bridge^7: ^3DUI^2 Sending new DUI to all players^7 - ^6"..data.url.."^7")
|
||||||
TriggerClientEvent(getScript()..":Client:ChangeDUI", -1, data)
|
TriggerClientEvent(getScript()..":Client:ChangeDUI", -1, data)
|
||||||
end)
|
end)
|
||||||
@@ -134,9 +127,9 @@ if gameName ~= "rdr3" then
|
|||||||
--- Server event handler to clear DUI settings.
|
--- Server event handler to clear DUI settings.
|
||||||
RegisterNetEvent(getScript()..":Server:ClearDUI", function(data)
|
RegisterNetEvent(getScript()..":Server:ClearDUI", function(data)
|
||||||
if data.url == "-" then
|
if data.url == "-" then
|
||||||
for k, v in pairs(duiList[data.name]) do
|
for k, v in pairs(Locations[data.name].duiList) do
|
||||||
if v.tex.texn == data.texn then
|
if v.tex.texn == data.texn then
|
||||||
duiList[data.name][k].url = "-"
|
Locations[data.name].duiList[k].url = "-"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -165,4 +158,4 @@ if gameName ~= "rdr3" then
|
|||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
Reference in New Issue
Block a user