[HELP] Simple tp to a pre-defined location

I want to make a script that will teleport you to a pre-defined location (coords) using a single chat command, can someone help me?

The script I made unfortunately does nothing :)) Help me fix it pls

My script:

RegisterCommand(“albamare”, function(player)
local user_id = vRP.getUserId({player})
if vRP.hasPermission({user_id, “admin.tickets”}) then
TriggerEvent(SetEntityCoords("-1166.4084472656,-1545.8493652344,19.574619293212") )
TriggerEvent(“chatMessage”, player, “Te-ai teleportat cu succes!”)

2 Likes

I’ve never used vRP, but do you have to TriggerEvent when using things like SetEntityCoords?

RegisterCommand(“albamare”, function(player)
local user_id = vRP.getUserId({player})
if vRP.hasPermission({user_id, “admin.tickets”}) then
SetEntityCoords(player, -1166.4084472656, -1545.8493652344, 19.574619293212)
TriggerEvent(“chatMessage”, player, “Te-ai teleportat cu succes!”)
end
end)

Would this work for you?

No :(((((

I did another version of Script, but it gives me an error and I don’t realize why

Script:
RegisterCommand(“albamare”, function(player)
SetEntityCoordsNoOffset(entity, -1166.4084472656,-1545.8493652344,19.574619293212, false, false, true)
SetGameplayCamRelativeHeading(0)
if IsPedSittingInAnyVehicle(PlayerPedId()) then
if GetPedInVehicleSeat(GetVehiclePedIsUsing(PlayerPedId()), -1) == PlayerPedId() then
SetVehicleOnGroundProperly(GetVehiclePedIsUsing(PlayerPedId()))
end
end
DoScreenFadeIn(250)
tvRP.notify(’~g~Teleported success!’)
end
end
end

Hello! Im far from the LUA, but maybe that code would work?

RegisterCommand("albamare", function(player)
        Citizen.CreateThread(function()
                DoScreenFadeOut(800)
                while not IsScreenFadedOut() do
                    Wait(1)
                end
                SetEntityCoords(GetPlayerPed(-1), -1166.4084472656, -1545.8493652344, 19.574619293212)
                SetEntityHeading(GetPlayerPed(-1), 0)
                DoScreenFadeIn(800)
                tvRP.notify("~g~Teleported success!")
            end)
    end)

Work!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.