So I’m new to LUA Development, trying to teach myself the basics before I get stuck in. I’m trying to set up a basic teleport script (currently with just one location set) and I want the script to know if the player is in a vehicle and whether to teleport the player alone or the vehicle with the player in it but it’s not working. I’m only teleporting the player.
Here is where I am at.
local v1 = vector2(101.94, -1937.1)
local v2 = vector3(101.94, -1937.1, 20.8)
local v3 = vector4(101.94, -1937.1, 20.8, 47.78)
local player = PlayerPedId()
local vehicle = GetVehiclePedIsUsing(player)
local pedInVehicle = false;
if vehicle == nil then
pedInVehicle = true;
else
pedInVehicle = false;
end
RegisterCommand(‘tp’, function()
– if player is in vehicle
if pedInVehicle == false then
– teleport vehicle
SetEntityCoords(player, v3, false, false, false, false)
– else player is not in vehicle
else
– teleport player
SetEntityCoords(vehicle, v3, false, false, false, false)
end
end)