Skip to content

Instantly share code, notes, and snippets.

@Rene-Sackers
Created August 19, 2016 17:11
Show Gist options
  • Save Rene-Sackers/58435fe7af77f0c87c3e669dc855f6a2 to your computer and use it in GitHub Desktop.
Save Rene-Sackers/58435fe7af77f0c87c3e669dc855f6a2 to your computer and use it in GitHub Desktop.
Teleporting function for FiveReborn in LUA.
RegisterNetEvent("Teleport")
AddEventHandler("Teleport", function(x, y, z)
x, y, z = tonumber(x), tonumber(y), tonumber(z)
local player = GetPlayerPed()
-- Fucking floats.
x = 0.0 + x
y = 0.0 + y
z = 0.0 + z
DisplayNotification("Teleporting to " .. x .. ", " .. y .. ", " .. z)
SetEntityCoordsNoOffset(player, x, y, z, false, false, false, true)
local newPos = GetEntityCoords(player, false)
DisplayNotification("New location: " .. newPos.x .. ", " .. newPos.y .. ", " .. newPos.z)
end)
@twmht
Copy link

twmht commented Mar 8, 2017

Where to put this file in fiveReborn?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment