I was trying to do that, but now i have a new error. Nothing happends!!!
Here is my new archives with code.
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({
action = openUI
})
end
if (IsControlJustReleased(0, 194)) then
FreezeEntityPosition(ped, false)
SendNuiMessage({
action = closeUI
})
end
end
end
end)
index.html
<html>
<head>
<script src = "nui://marker_actions/app.js" type = "text/javascript"></script>
<link rel = "stylesheet" href = "nui://marker_actions/b.css">
</head>
<body>
<div style = "display: none;", id = "showui">
<div class = "container">
<iframe width="100%" height="100%" src="https://www.youtube.com/watch?v=_2FxRHFr5sg&t=17417s" title="Youtube video player"
frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen></iframe>
</div>
</div>
</body>
</html>
b.css
* {
margin: 0;
padding: 0;
}
body {
background-color: transparent !important;
}
#showui {
width: 750px;
height: 500px;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
overflow: hidden;
opacity: 80%;
}
.container {
width: 400px;
height: 225px;
}
app.js
window.addEventListener('message', function(event) {
switch (event.data.action) {
case 'openUI':
$('#show').fadeIn();
setTimeout(function (){
$('#show').fadeOut(400)
}, 6000)
break;
}
}, false)
The console doesn’t says anything. Im crying
