Jump to content

[HELP] With the teleport script


Recommended Posts

Hello friends, I clarify that I do not understand much about programming, I need help.

I want to make this TP script work with cars, to activate it by playing the horn of the car, so that I can teleport in the same vehicle to a specific point, and thus give it a use for "Garages", I tried to change the BindKey to "horn " but it doesn't work for me, I would really appreciate it if you could help me.

 



local interiors = {
-- {Ext"X",          Ext"Y",        Ext"Z", |  IDInt, IDDim | IntX, IntY, IntZ | IDInt, IDDim | "Nombre"},
             
{1177.90234375, -1338.9755859375, 14.912269592285, 0, 0, 447, 2520, -98, 10, 0, "LSMD"},
{1195.3037109375, -1354.92578125, 13.389284133911, 0, 0, 1198.0654296875, -1402.2587890625, 13.257797241211, 0, 0, "Prueba"},
 

}
enterPickup = nil
exitPickup = nil

local bind = "Enter"
local screenW, screenH = guiGetScreenSize()
addEventHandler("onClientResourceStart", resourceRoot, function()
for i,v in pairs (interiors) do
local enterPickup = createPickup(v[1], v[2], v[3], 3, 1318, 1)
setElementInterior(enterPickup, v[4])
setElementDimension(enterPickup, v[5])
local exitPickup = createPickup(v[6], v[7], v[8], 3, 1318, 1)
setElementInterior(exitPickup, v[9])
setElementDimension(exitPickup, v[10])
addEventHandler("onClientRender", root, function()
if (isElementWithinPickup(localPlayer, enterPickup)) and getElementInterior(localPlayer) == getElementInterior(enterPickup) and getElementDimension(localPlayer) == getElementDimension(enterPickup) then
dxDrawHelp("Propiedad : "..v[11], "Presiona "..bind.." para entrar.")
elseif (isElementWithinPickup(localPlayer, exitPickup)) and getElementInterior(localPlayer) == getElementInterior(exitPickup) and getElementDimension(localPlayer) == getElementDimension(exitPickup) then
dxDrawHelp("Propiedad : "..v[11], "Presiona "..bind.." para salir.")
end
end)

bindKey(bind, "down", function()
if (isElementWithinPickup(localPlayer, enterPickup)) and getElementInterior(localPlayer) == getElementInterior(enterPickup) and getElementDimension(localPlayer) == getElementDimension(enterPickup) then
triggerServerEvent("warpPlayer", localPlayer, localPlayer, v[6], v[7], v[8], v[9], v[10])
elseif (isElementWithinPickup(localPlayer, exitPickup)) and getElementInterior(localPlayer) == getElementInterior(exitPickup) and getElementDimension(localPlayer) == getElementDimension(exitPickup) then
triggerServerEvent("warpPlayer", localPlayer, localPlayer, v[1], v[2], v[3], v[4], v[5])
end
end)
end

end)


local blips = { -- blip ekleye bilirsiniz.
 {810.4853515625, -1616.16015625, 13.546875, 10},
}

for i,v in pairs (blips) do
 createBlip(v[1], v[2], v[3], v[4], 2, 255, 255, 255, 255, 0, 100)
end

function guiGridListGetSelectedItemText ( gridList, column )
    local item = guiGridListGetSelectedItem ( gridList )
    if item then
        return guiGridListGetItemText ( gridList, item, column or 1 )
    end
    return false
 end

	
--
function isElementWithinPickup(theElement, thePickup)
	if (isElement(theElement) and getElementType(thePickup) == "pickup") then
		local x, y, z = getElementPosition(theElement)
		local x2, y2, z2 = getElementPosition(thePickup)
		if (getDistanceBetweenPoints3D(x2, y2, z2, x, y, z) <= 1) then
			return true
		end
	end
	return false
end

function round(num) 
	if ( num >= 0 ) then return math.floor( num + .5 ) 
	else return math.ceil( num - .5 ) end
end

function convertNumber( number )  
	local formatted = number  
	while true do      
		formatted, k = string.gsub( formatted, "^(-?%d+)(%d%d%d)", '%1 %2' )    
		if ( k==0 ) then      
			break   
		end  
	end  
	return formatted
end

function guiComboBoxAdjustHeight ( combobox, itemcount )
	if getElementType ( combobox ) ~= "gui-combobox" or type ( itemcount ) ~= "number" then error ( "Invalid arguments @ 'guiComboBoxAdjustHeight'", 2 ) end
	local width = guiGetSize ( combobox, false )
	return guiSetSize ( combobox, width, ( itemcount * 20 ) + 20, false )
end

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...