dialogu fixu

I have god and anime on my side!
This commit is contained in:
gononono64 committed 2025-06-04 18:06:53 -05:00
1 parent 3fa933fab1
commit 5a95b86392
1 file changed
+63 -71
+63 -71
View File
@@ -55,26 +55,18 @@ function Dialogue.Open( name, dialogue, characterOptions, dialogueOptions, onSel
-- camera magic! -- camera magic!
if entity then if entity then
Wait(500)
local endLocation = GetOffsetFromEntityInWorldCoords(entity, offset.x, offset.y + 2.0, offset.z + 0.5)
local pedHeading = GetEntityHeading(entity) local pedHeading = GetEntityHeading(entity)
-- Convert heading to radians and calculate offset
local angleRad = math.rad(pedHeading)
local offsetX = math.sin(angleRad) * 1.5
local offsetY = math.cos(angleRad) * 1.5
-- Get position in front of ped based on their heading -- Get position in front of ped based on their heading
local endLocation = GetEntityCoords(entity) + vector3(offsetX * offset.x, offsetY * offset.y, 0.5)
if not cam then cam = CreateCam("DEFAULT_SCRIPTED_CAMERA", 1) end if not cam then cam = CreateCam("DEFAULT_SCRIPTED_CAMERA", 1) end
local camPos = GetCamCoord(cam) local camAngle = (pedHeading + 180.0) % 360.0
local dist = #(endLocation - camPos) SetCamRot(cam, rotationOffset.x, rotationOffset.y, camAngle + rotationOffset.z, 2)
local abs = cam and math.abs(dist) SetCamCoord(cam, endLocation.x, endLocation.y, endLocation.z)
if not abs or abs > 0.5 then RenderScriptCams(true, true, 1000, true, false)
local camAngle = (pedHeading + 180.0) % 360.0 SetCamActive(cam, true)
SetCamRot(cam, rotationOffset.x, rotationOffset.y, camAngle + rotationOffset.z, 2)
SetCamCoord(cam, endLocation.x, endLocation.y, endLocation.z)
RenderScriptCams(true, true, 1000, true, false)
SetCamActive(cam, true)
end
end end
SendNUIMessage({ SendNUIMessage({
type = "open", type = "open",
@@ -105,62 +97,62 @@ end)
-- Debug command -- Debug command
if BridgeSharedConfig.DebugLevel >= 1 then if BridgeSharedConfig.DebugLevel >= 1 then
RegisterCommand("dialogue", function() -- RegisterCommand("dialogue", function()
local pos = GetOffsetFromEntityInWorldCoords(PlayerPedId(), 0, 2.0, 0) -- local pos = GetOffsetFromEntityInWorldCoords(PlayerPedId(), 0, 2.0, 0)
local timeout = 500 -- local timeout = 500
local model = `a_f_y_hipster_01` -- local model = `a_f_y_hipster_01`
RequestModel(model) -- RequestModel(model)
while not HasModelLoaded(model) do -- while not HasModelLoaded(model) do
Wait(0) -- Wait(0)
timeout = timeout - 1 -- timeout = timeout - 1
if timeout == 0 then -- if timeout == 0 then
print("Failed to load model") -- print("Failed to load model")
return -- return
end -- end
end -- end
local ped = CreatePed(0, model, pos.x, pos.y, pos.z, 0.0, false, false) -- local ped = CreatePed(0, model, pos.x, pos.y, pos.z, 0.0, false, false)
local characterData = { -- local characterData = {
entity = ped, -- entity = ped,
offset = vector3(0, 0, 0), -- offset = vector3(0, 0, 0),
rotationOffset = vector3(0, 0, 0) -- rotationOffset = vector3(0, 0, 0)
} -- }
Wait(750) -- Wait(750)
Dialogue.Open("Akmed", "Hello how are you doing my friend?", characterData, { -- Dialogue.Open("Akmed", "Hello how are you doing my friend?", characterData, {
{ -- {
label = "Trade with me", -- label = "Trade with me",
id = 'something', -- id = 'something',
}, -- },
{ -- {
label = "Goodbye", -- label = "Goodbye",
id = 'someotherthing', -- id = 'someotherthing',
}, -- },
}, -- },
function(selectedId) -- function(selectedId)
if selectedId == 'something' then -- if selectedId == 'something' then
Dialogue.Open( "Akmed" , "Thank you for wanting to purchase me lucky charms", characterData, { -- Dialogue.Open( "Akmed" , "Thank you for wanting to purchase me lucky charms", characterData, {
{ -- {
label = "Fuck off", -- label = "Fuck off",
id = 'something', -- id = 'something',
}, -- },
{ -- {
label = "Goodbye", -- label = "Goodbye",
id = 'someotherthing', -- id = 'someotherthing',
}, -- },
}, -- },
function(selectedId) -- function(selectedId)
DeleteEntity(ped) -- DeleteEntity(ped)
if selectedId == "something" then -- if selectedId == "something" then
print("You hate lucky charms") -- print("You hate lucky charms")
else -- else
print("Thanks for keeping it civil") -- print("Thanks for keeping it civil")
end -- end
end) -- end)
else -- else
DeleteEntity(ped) -- DeleteEntity(ped)
end -- end
end) -- end)
end) -- end)
end end
return Dialogue return Dialogue