Hey guys, I hope someone can help me. I am trying to add teleporting to the Scorpion Trainer.
The following should teleport to the waypoint but it doesn’t teleport to the right coords.
RegisterNUICallback("teleport", function(data, cb)
local playerPed = GetPlayerPed(-1)
local action = data.action
local VehicleHandle = GetClosestVehicle(GetEntityCoords(playerPed, true), 999999.0, 0, 71)
local WaypointHandle = GetFirstBlipInfoId(8)
local WaypointPos = GetBlipCoords(WaypointHandle)
local playerVeh = GetVehiclePedIsIn(playerPed, 0)
local newPos = GetEntityCoords(playerPed, false)
if action == "nearestcar" then
SetPedIntoVehicle(playerPed, VehicleHandle, -1)
drawNotification("~g~Teleported Into Nearest Car.")
elseif action == "waypoint" then
if DoesBlipExist(WaypointHandle) then
if IsPedInAnyVehicle(playerPed, 0) then
SetEntityCoordsNoOffset(playerVeh, WaypointPos, 0, 0, 0)
else
SetEntityCoordsNoOffset(playerPed, WaypointPos, 0, 0, 0)
end
drawNotification("New location: " .. newPos.x .. ", " .. newPos.y .. ", " .. newPos.z)
drawNotification("~g~Teleported To Waypoint!")
else
drawNotification("~r~No Waypoint Set!")
end
end
cb("ok")
end)
Somehow GetBlipCoords
outputs a 10 - digit number instead of coordinates
I hope someone can help me