Hello guys, I’m very new on development resources (literally i’m starting learning since 2 weeks ago) but I wanna try to do an help for the server jobs, a little nui window with a tutorial video who opens when players press E close to the text.
The problem is the nui windows with the video is ALWAYS open and can’t interact with that, here are my scripts files with the code and a image with the window open. If someone knows how to help me, I will be very gratefull with all of you with all my heart, I would like to be a great person making scripts and use the knowloage to make my own server with personalized scripts.
Image of the window open
fxmanifest.lua
fx_version 'cerulean'
game 'gta5'
client_scripts {
'client.lua',
}
server_scripts{
'server.lua',
}
ui_page {
'index.html'
}
files {
'index.html'
}
client.lua
local markerPos = vector3(681.4806, 564.3262, 129.0461)
local ped = GetPlayerPed(-1)
function Draw3DText(x, y, z, scl_factor, text)
local onScreen, _x, _y = World3dToScreen2d(x, y, z)
local p = GetGameplayCamCoords()
local distance = GetDistanceBetweenCoords(p.x, p.y, p.z, x, y, z, 1)
local scale = (1 / distance) * 2
local fov = (1 / GetGameplayCamFov()) * 100
local scale = scale * fov * scl_factor
if onScreen then
SetTextScale(0.0, scale)
SetTextFont(0)
SetTextProportional(1)
SetTextColour(255, 255, 255, 255)
SetTextDropshadow(0, 0, 0, 0, 255)
SetTextEdge(2, 0, 0, 0, 150)
SetTextDropShadow()
SetTextOutline()
SetTextEntry("STRING")
SetTextCentre(1)
AddTextComponentString(text)
DrawText(_x, _y)
end
end
Citizen.CreateThread(function()
local ped = GetPlayerPed(-1)
while true do
Citizen.Wait(0)
local playerCoords = GetEntityCoords(ped)
local distance = #(playerCoords - markerPos)
if distance < 20.0 then
DrawMarker(
32,
markerPos.x,
markerPos.y,
markerPos.z + 1,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
2.0,
2.0,
2.0,
255,
128,
0,
50,
false,
true,
2,
null,
null,
null,
false
)
if distance < 5.0 then
Draw3DText(markerPos.x, markerPos.y, markerPos.z + 1, 1.5, "Presiona [E] para ver un tutorial del trabajo")
end
if (IsControlJustReleased(0, 38)) then
FreezeEntityPosition(ped, true)
SendNuiMessage({
open = true
})
end
if (IsControlJustReleased(0, 194)) then
FreezeEntityPosition(ped, false)
SendNuiMessage({
open = false
})
end
end
end
end)
index.html
<!DOCTYPE html>
<html>
<body>
<video width="400" controls>
<source src="mov_bbb.mp4" type="video/mp4">
<source src="mov_bbb.ogg" type="video/ogg">
Your browser does not support HTML video.
</video>
</body>
</html>
Again, thank u all for reading this post and very thank u for help me. I’m stuck and this point so that’s why I come here to ask for help.