mirror of
https://github.com/Michatec/ptelevision.git
synced 2026-03-31 23:46:30 +02:00
Update main.lua
This commit is contained in:
@@ -37,20 +37,9 @@ local height = 720
|
|||||||
local sfHandle = nil
|
local sfHandle = nil
|
||||||
local txdHasBeenSet = false
|
local txdHasBeenSet = false
|
||||||
|
|
||||||
|
|
||||||
function loadScaleform(scaleform)
|
|
||||||
local scaleformHandle = RequestScaleformMovie(scaleform)
|
|
||||||
|
|
||||||
while not HasScaleformMovieLoaded(scaleformHandle) do
|
|
||||||
scaleformHandle = RequestScaleformMovie(scaleform)
|
|
||||||
Citizen.Wait(0)
|
|
||||||
end
|
|
||||||
return scaleformHandle
|
|
||||||
end
|
|
||||||
|
|
||||||
function ShowScreen(data)
|
function ShowScreen(data)
|
||||||
CURRENT_SCREEN = data
|
CURRENT_SCREEN = data
|
||||||
sfHandle = loadScaleform(sfName)
|
sfHandle = lib.requestScaleformMovie(sfName)
|
||||||
runtimeTxd = 'ptelevision_b_dict'
|
runtimeTxd = 'ptelevision_b_dict'
|
||||||
|
|
||||||
local txd = CreateRuntimeTxd('ptelevision_b_dict')
|
local txd = CreateRuntimeTxd('ptelevision_b_dict')
|
||||||
@@ -105,7 +94,7 @@ function ShowScreen(data)
|
|||||||
SetVolume(coords, modelData.DefaultVolume)
|
SetVolume(coords, modelData.DefaultVolume)
|
||||||
end
|
end
|
||||||
while duiObj do
|
while duiObj do
|
||||||
local pcoords = GetEntityCoords(PlayerPedId())
|
local pcoords = GetEntityCoords(cache.ped)
|
||||||
local dist = #(coords - pcoords)
|
local dist = #(coords - pcoords)
|
||||||
SendDuiMessage(duiObj, json.encode({
|
SendDuiMessage(duiObj, json.encode({
|
||||||
setVolume = true,
|
setVolume = true,
|
||||||
@@ -129,7 +118,7 @@ end
|
|||||||
function GetClosestScreen()
|
function GetClosestScreen()
|
||||||
local objPool = GetGamePool('CObject')
|
local objPool = GetGamePool('CObject')
|
||||||
local closest = {dist = -1}
|
local closest = {dist = -1}
|
||||||
local pcoords = GetEntityCoords(PlayerPedId())
|
local pcoords = GetEntityCoords(cache.ped)
|
||||||
for i=1, #objPool do
|
for i=1, #objPool do
|
||||||
local entity = objPool[i]
|
local entity = objPool[i]
|
||||||
local model = GetEntityModel(entity)
|
local model = GetEntityModel(entity)
|
||||||
@@ -165,9 +154,9 @@ Citizen.CreateThread(function()
|
|||||||
local wait = 2500
|
local wait = 2500
|
||||||
for i=1, #Locations do
|
for i=1, #Locations do
|
||||||
local data = Locations[i]
|
local data = Locations[i]
|
||||||
local dist = #(GetEntityCoords(PlayerPedId()) - v3(data.Position))
|
local dist = #(GetEntityCoords(cache.ped) - v3(data.Position))
|
||||||
if not Locations[i].obj and dist < 20.0 then
|
if not Locations[i].obj and dist < 20.0 then
|
||||||
LoadModel(data.Model)
|
lib.requestModel(data.Model)
|
||||||
Locations[i].obj = CreateObject(data.Model, data.Position.x, data.Position.y, data.Position.z)
|
Locations[i].obj = CreateObject(data.Model, data.Position.x, data.Position.y, data.Position.z)
|
||||||
SetEntityHeading(Locations[i].obj, data.Position.w)
|
SetEntityHeading(Locations[i].obj, data.Position.w)
|
||||||
FreezeEntityPosition(Locations[i].obj, true)
|
FreezeEntityPosition(Locations[i].obj, true)
|
||||||
@@ -207,11 +196,9 @@ RegisterNetEvent("ptelevision:requestSync", function(coords, data)
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
RegisterNUICallback("pageLoaded", function(data, cb)
|
||||||
|
|
||||||
RegisterNUICallback("pageLoaded", function(cb)
|
|
||||||
waitForLoad = false
|
waitForLoad = false
|
||||||
if cb then cb() end
|
cb(1)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
AddEventHandler('onResourceStop', function(name)
|
AddEventHandler('onResourceStop', function(name)
|
||||||
@@ -222,5 +209,3 @@ AddEventHandler('onResourceStop', function(name)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user