mirror of
https://github.com/sky-systems/sky_phone.git
synced 2026-08-29 08:01:36 +00:00
30559048fd
* FIX - preserve LB custom app lifecycle * FIX - reset LB export aliases before startup * FIX - report competing custom app providers * FIX - identify LB app frames as live NUI * FIX - complete LB custom app compatibility * FIX - provide LB PicChat runtime exports * FIX - route LB PicChat through Sky Phone * FIX - return cached LB equipped phone number * FIX - harden PicChat compatibility migration * ENH - complete modular phone provider and Creator APIs * DOC - document the Sky Phone Creator API --------- Co-authored-by: DerEchteAlec <bycraky@gmail.com> Co-authored-by: DerEchteAlec <alec.schitzkat@luwan.io>
35 lines
1.0 KiB
Lua
35 lines
1.0 KiB
Lua
local function player_coordinates()
|
|
local coords = GetEntityCoords(PlayerPedId())
|
|
return {
|
|
x = coords.x,
|
|
y = coords.y,
|
|
z = coords.z,
|
|
}
|
|
end
|
|
|
|
RegisterNUICallback("map:getPlayerCoords", function(data, cb)
|
|
if type(data) ~= "table" then
|
|
cb({ success = false, error = "invalid_request" })
|
|
return
|
|
end
|
|
|
|
cb({ success = true, data = { coords = player_coordinates() } })
|
|
end)
|
|
|
|
RegisterNUICallback("map:setWaypoint", function(data, cb)
|
|
local coords = type(data) == "table" and data.coords or nil
|
|
local x = type(coords) == "table" and tonumber(coords.x) or nil
|
|
local y = type(coords) == "table" and tonumber(coords.y) or nil
|
|
if not x or not y or x ~= x or y ~= y or math.abs(x) > 10000.0 or math.abs(y) > 10000.0 then
|
|
cb({ success = false, error = "invalid_marker" })
|
|
return
|
|
end
|
|
|
|
SetNewWaypoint(x, y)
|
|
cb({ success = true })
|
|
end)
|
|
|
|
RegisterNUICallback("skyride:get-player-coords", function(_, cb)
|
|
cb({ success = true, data = { coords = player_coordinates() } })
|
|
end)
|