Jump to content

Alguem me ajuda nesse script garagem BGO?


Recommended Posts

Ola eu tenho um sistema de garagem do BGO peguei na net com concecionaria. so que marker tem como despawnar o veiculo pelo maker sem o veiculo estar em cima. eu queria que so podesse remover o veiculo so com ele em cima do marker alguem me ajuda?

Arquivo server
 

--------------------------------------------------------------
-- © [2019] Varzen Advanced [2019]                        © --
-- © Creditos: Varzen Advanced                            © --
-- © Facebook: https://www.facebook.com/VarzenAdvanced    © --
-- © Youtube: http://www.youtube.com/c/VarzenBR           © --
-- © Blog: https://varzenadvanced.blogspot.com/           © --
--------------------------------------------------------------

addEvent("updateINTDIM2", true)
addEventHandler("updateINTDIM2", getRootElement(), function (vehicleId)
        for index, value in ipairs (getElementsByType("vehicle")) do
            if getElementData(value, "ID") == tonumber(vehicleId) then
                if getElementData(value, "ownercar") == getElementData(source, "ID") then
                    setElementInterior(value,0)
                    setElementDimension(value,0)
                    local x, y, z = getElementPosition(source)
                    setElementPosition(value, x, y, z)
                    warpPedIntoVehicle(source,value)
            end
        end
    end
end
)

addEvent("guardar", true)
addEventHandler("guardar", getRootElement(), function (vehicleId)
        for index, value in ipairs (getElementsByType("vehicle")) do
            if getElementData(value, "ID") == tonumber(vehicleId) then
                if getElementData(value, "ownercar") == getElementData(source, "ID") then
                local gerarposicao = math.random(50,100)
                    setElementPosition(value,1805.39368, -2448.51196, 13.44729)
                    setElementInterior(value,gerarposicao)
                    setElementDimension(value,gerarposicao)
                    outputChatBox("#9ACD32[SRP] #ffffffVeículo Guardado.",source,0,0,0,true)
            end
        end
    end
end
)

addEvent("updateINTDIM22", true)
addEventHandler("updateINTDIM22", getRootElement(), function (vehicleId)
        for index, value in ipairs (getElementsByType("vehicle")) do
            if getElementData(value, "ID") == tonumber(vehicleId) then
                if getElementData(value, "ownercar") == getElementData(source, "ID") then
                    setElementInterior(value,0)
                    setElementDimension(value,0)
            end
        end
    end
end
)



--------------------
Arquivo Cliente

--------------------------------------------------------------
-- © [2019] Varzen Advanced [2019]                        © --
-- © Creditos: Varzen Advanced                            © --
-- © Facebook: https://www.facebook.com/VarzenAdvanced    © --
-- © Youtube: http://www.youtube.com/c/VarzenBR           © --
-- © Blog: https://varzenadvanced.blogspot.com/           © --
--------------------------------------------------------------

local customCarNames =

{
    {474, "Fusca"},
    {526, "Gol Gts"},
    {410, "Chevette"},
    {436, "Gol G4"},
    {589, "Uno"},
    {600, "Saveiro G7"},
    {400, "EcoEsport"},
    {579, "Fiat Touro"},
    {587, "Bmw M3"},
    {580, "Porsche Cayenne"},
    {506, "Ferrari F430"},
    {603, "Camaro"},
    {451, "Lamborghine Galardo"},
    {439, "Dodge charger"},
    {586, "Titan-160"},
    {468, "XT-660"},
    {521, "XJ6"},
    {581, "S1000"},
    {522, "CB1000"},

}


function getVehicleRealName(model)
    for k, v in ipairs(customCarNames) do
        if v[1] == model then
            return v[2]
        end
    end
    return "Desconhecido"
end

local odimension = getElementDimension(localPlayer)
local ointerior = getElementInterior(localPlayer)
local screenSize = {guiGetScreenSize()}
screenSize.x, screenSize.y = screenSize[1], screenSize[2]
local myScreenSource = dxCreateScreenSource(screenSize.x, screenSize.y)

function infoSound(file)
    playSound("files/sounds/"..file..".mp3")
end

function isCursorHover(startX, startY, sizeX, sizeY)
    if isCursorShowing() then
        local cursorPosition = {getCursorPosition()}
        cursorPosition.x, cursorPosition.y = cursorPosition[1] * screenSize.x, cursorPosition[2] * screenSize.y
        if cursorPosition.x >= startX and cursorPosition.x <= startX + sizeX and cursorPosition.y >= startY and cursorPosition.y <= startY + sizeY then
            return true
        else
            return false
        end
    else
        return false
    end
end

local dashboardOpened = false
local dutyskinOpened = false
local width, height = 800, 450
local startX, startY = (screenSize.x - width) / 2 , (screenSize.y - height) / 2
local bgColor = tocolor(0, 0, 0, 180)
local slotColor = tocolor(40, 40, 40, 200)
local hoverColor = tocolor(154, 205, 50, 180)
local secondColor = tocolor(154, 205, 50, 180)
local cancelColor = tocolor(243, 85, 85, 180)

local spacer = 2
local spacerBig = 5

local roboto = dxCreateFont("files/fonts/Roboto.ttf", 8, false, "proof")
local robotoBold = dxCreateFont("files/fonts/Roboto.ttf", 10, true, "proof")
local robotoBig = dxCreateFont("files/fonts/Roboto.ttf", 11, false, "proof")
local robotoBig2 = dxCreateFont("files/fonts/Roboto.ttf", 10, false, "proof")
local robotoGui = guiCreateFont("files/fonts/Roboto.ttf", 9)

local menuPoints = {{"Propriedade", "property"}}
local menuPointsWidth = (width - (#menuPoints - 1) * spacerBig) / #menuPoints
local playerInfos = {}

local optionsText = {"Ativado"}
optionsText[0] = "Desligado"
local changeTips = {"Desligar"}
changeTips[0] = "Ligar"
local vehicleTuningDatas = {{"engine", "Motor"}, {"turbo", "turbo"}, {"gearbox", "projeto de lei"}, {"ecu", "Ecu"}, {"pneus", "goma"}, {"brakes", "freio"}}
local vehicleTunings = {"#999999Não", "#acd737Rua", "#ffcc00Profissional", "#ff6600Competição", "#ff1a1aEngrenagem" , "#ff1a1aEngrenagem"}
vehicleTunings[0] = "#999999não"


local optionsCreateColor = ""
local optionsCreateText = ""
local maxdistance = 0

local groupMembers = {}
local groupVehicles = {}
local meInGroup = {}

local admins = {}
local openedTick = getTickCount() - 2000

parkYerleri =  {}
park = dxCreateTexture("parking.png")
parkYerleri = createMarker(1457.3518066406, -1783.7336425781, 13.546875-0.95, "cylinder", 2, 0, 176, 196, 10 )
parkYerleri2 = createMarker(1925.9207763672,-1857.4606933594,13.90625-0.95, "cylinder", 2, 0, 176, 196, 10 )
parkYerleri3 = createMarker(-2234.9548339844,2357.5026855469,5-0.95, "cylinder", 2, 0, 176, 196, 10 )
parkYerleri4 = createMarker(1705.2884521484,-1100.5689697266,23.178125, "cylinder", 2, 0, 176, 196, 10 )
parkYerleri5 = createMarker(2544.34, 2880.475, 104.769-0.95, "cylinder", 2, 0, 176, 196, 10 )
parkYerleri6 = createMarker(2814.2902832031, -1539.9907226563, 10.455365180969, "cylinder", 2, 0, 176, 196, 10 )


local myBlip = createBlipAttachedTo ( parkYerleri, 55 )
local myBlip2 = createBlipAttachedTo ( parkYerleri2, 55 )
local myBlip3 = createBlipAttachedTo ( parkYerleri3, 55 )
local myBlip4 = createBlipAttachedTo ( parkYerleri4, 55 )
local myBlip5 = createBlipAttachedTo ( parkYerleri5, 55 )
local myBlip6 = createBlipAttachedTo ( parkYerleri6, 55 )


function parkYeri()

    _3DResim(parkYerleri,park);
    _3DResim(parkYerleri2,park);
    _3DResim(parkYerleri3,park);
    _3DResim(parkYerleri4,park);
    _3DResim(parkYerleri5,park);
    _3DResim(parkYerleri6,park);
end
addEventHandler("onClientRender", getRootElement(), parkYeri)


addEventHandler( "onClientMarkerHit", parkYerleri6,
function ( hitElement, matchingDimension )
   if getElementType(hitElement) == "player" and (hitElement == localPlayer) then
        currentPage = 1
        dashboardOpened = true
        openedTick = getTickCount()
        getMyVehicles()
        maxVehicleRows = 9
        currentVehicleRow = 1
        lastVehicleRow = 1
        selectedVehicle = 1
    end
end
)
addEventHandler( "onClientMarkerLeave", parkYerleri6,
function ( hitElement, matchingDimension )
   if getElementType(hitElement) == "player" and (hitElement == localPlayer) then
    dashboardOpened = false
    end
end
)


addEventHandler( "onClientMarkerHit", parkYerleri5,
function ( hitElement, matchingDimension )
   if getElementType(hitElement) == "player" and (hitElement == localPlayer) then
        currentPage = 1
        dashboardOpened = true
        openedTick = getTickCount()
        getMyVehicles()
        maxVehicleRows = 9
        currentVehicleRow = 1
        lastVehicleRow = 1
        selectedVehicle = 1
    end
end
)
addEventHandler( "onClientMarkerLeave", parkYerleri5,
function ( hitElement, matchingDimension )
   if getElementType(hitElement) == "player" and (hitElement == localPlayer) then
    dashboardOpened = false
    end
end
)


addEventHandler( "onClientMarkerHit", parkYerleri4,
function ( hitElement, matchingDimension )
   if getElementType(hitElement) == "player" and (hitElement == localPlayer) then
        currentPage = 1
        dashboardOpened = true
        openedTick = getTickCount()
        getMyVehicles()
        maxVehicleRows = 9
        currentVehicleRow = 1
        lastVehicleRow = 1
        selectedVehicle = 1
    end
end
)
addEventHandler( "onClientMarkerLeave", parkYerleri4,
function ( hitElement, matchingDimension )
   if getElementType(hitElement) == "player" and (hitElement == localPlayer) then
    dashboardOpened = false
    end
end
)


addEventHandler( "onClientMarkerHit", parkYerleri3,
function ( hitElement, matchingDimension )
   if getElementType(hitElement) == "player" and (hitElement == localPlayer) then
        currentPage = 1
        dashboardOpened = true
        openedTick = getTickCount()
        getMyVehicles()
        maxVehicleRows = 9
        currentVehicleRow = 1
        lastVehicleRow = 1
        selectedVehicle = 1
    end
end
)
addEventHandler( "onClientMarkerLeave", parkYerleri3,
function ( hitElement, matchingDimension )
   if getElementType(hitElement) == "player" and (hitElement == localPlayer) then
    dashboardOpened = false
    end
end
)


addEventHandler( "onClientMarkerHit", parkYerleri2,
function ( hitElement, matchingDimension )
   if getElementType(hitElement) == "player" and (hitElement == localPlayer) then
        currentPage = 1
        dashboardOpened = true
        openedTick = getTickCount()
        getMyVehicles()
        maxVehicleRows = 9
        currentVehicleRow = 1
        lastVehicleRow = 1
        selectedVehicle = 1
    end
end
)
addEventHandler( "onClientMarkerLeave", parkYerleri2,
function ( hitElement, matchingDimension )
   if getElementType(hitElement) == "player" and (hitElement == localPlayer) then
    dashboardOpened = false
    end
end
)

addEventHandler( "onClientMarkerHit", parkYerleri,
function ( hitElement, matchingDimension )
   if getElementType(hitElement) == "player" and (hitElement == localPlayer) then
        currentPage = 1
        dashboardOpened = true
        openedTick = getTickCount()
        getMyVehicles()
        maxVehicleRows = 9
        currentVehicleRow = 1
        lastVehicleRow = 1
        selectedVehicle = 1
    end
end
)
addEventHandler( "onClientMarkerLeave", parkYerleri,
function ( hitElement, matchingDimension )
   if getElementType(hitElement) == "player" and (hitElement == localPlayer) then
    dashboardOpened = false
    end
end
)

addEventHandler("onClientDoubleClick", root, function(button)
    if button == "left" and dashboardOpened and currentPage == 1 then
        local selectedVehicleToGps = false
        lastVehicleRow = currentVehicleRow + maxVehicleRows - 1
        for key, value in ipairs(myVehicles) do
            if key >= currentVehicleRow and key <= lastVehicleRow then
                key = key - currentVehicleRow + 1
                local forY = startY + 2 * spacerBig + 30 + spacer + (key - 1) * 22
                if isCursorHover(startX + 2 * spacerBig + spacer, forY, width / 2 - 4 * spacerBig - 2 * spacer, 20) then
                    selectedVehicleToGps = key + currentVehicleRow - 1
                end
            end
        end

        if tonumber(selectedVehicleToGps) then
            --triggerServerEvent("updateINTDIM2", localPlayer, getElementData(myVehicles[selectedVehicleToGps], "ID"))
            gpsVehicle("gps", getElementData(myVehicles[selectedVehicleToGps], "ID"))
        end
    end
end
)


function gpsVehicle(commandName, vehicleId)
if not vehicleId then
    outputChatBox("#9ACD32[SRP] #ffffffVocê não pode guardar um veículo com placa fria.",0,0,0,true)
    return
end
    if vehicleId then
        for index, value in ipairs (getElementsByType("vehicle")) do
            if getElementData(value, "ID") == tonumber(vehicleId) then
                if not getElementData(value, "ownercar") == getElementData(localPlayer, "ID") then
                   outputChatBox("#9ACD32[SRP] #ffffffVocê não é o dono do veículo!",0,0,0,true)
                   return
                end
                    local counter = 0
                for seat, player in pairs(getVehicleOccupants(value)) do
                counter = counter + 1
                end
                if counter > 0 then outputChatBox("#9ACD32[SRP] #ffffffNão pode guardar com um ocupante.",0,0,0,true)  return
                    end
                    if (getElementDimension(value) == 0) then
                    setElementData(value,"veiculo.garagem", true)
                    triggerServerEvent("guardar", localPlayer, vehicleId)
                    return
                    end
                    if (getElementData(value, "detranAP")) then
                        outputChatBox("#9ACD32[SRP] #ffffffSeu veiculo está no detran!",0,0,0,true)
                        triggerServerEvent("updateINTDIM22", localPlayer, vehicleId)
                    else
                    triggerServerEvent("updateINTDIM2", localPlayer, vehicleId)
                    outputChatBox("#9ACD32[SRP] #ffffffVeiculo retirado.",0,0,0,true)
                    setElementData(value,"veiculo.garagem", false)
                 end
            end
        end
    end
end


addEventHandler("onClientKey", root, function(button, pressed)
    if pressed and getElementData(localPlayer, "CharLoggedIn") then
        --if button == "F4" then
            --changeState()
            --cancelEvent()
        --end
        if dashboardOpened then
            if currentPage == 1 then
                if isCursorHover(startX + 2 * spacerBig, startY + 2 * spacerBig + 30, width / 2 - 4 * spacerBig, maxVehicleRows * 22 + spacer) then
                    if button == "mouse_wheel_down" then
                        if currentVehicleRow < #myVehicles - (maxVehicleRows - 1) then
                            currentVehicleRow = currentVehicleRow + 1
                        end
                    elseif button == "mouse_wheel_up" then
                        if currentVehicleRow > 1 then
                            currentVehicleRow = currentVehicleRow - 1
                        end
                    elseif button == "mouse1" then
                        lastVehicleRow = currentVehicleRow + maxVehicleRows - 1
                        for key, value in ipairs(myVehicles) do
                            if key >= currentVehicleRow and key <= lastVehicleRow then
                                key = key - currentVehicleRow + 1
                                local forY = startY + 2 * spacerBig + 30 + spacer + (key - 1) * 22
                                if isCursorHover(startX + 2 * spacerBig + spacer, forY, width / 2 - 4 * spacerBig - 2 * spacer, 20) then
                                    selectedVehicle = key + currentVehicleRow - 1
                                end
                            end
                        end
                    end
                end

            end
        end
    end
end
)

addEventHandler("onClientElementDataChange", root, function(dataName, oldValue)
    if source and getElementType(source) == "player" then
        if source == localPlayer then
            if dataName == "char:vehSlot" then
                getMyVehicles()
        end
    end
    end
end)

function thousandsStepper(amount)
    local formatted = amount
    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 getMyVehicles()
    myVehicles = {}
    for key, value in ipairs(getElementsByType("vehicle")) do
        if getElementData(value,"ownercar") == getElementData(localPlayer,"ID") then
            table.insert(myVehicles, value)
        end
    end
    vehicleInfos = {"Solaria RolePlay - Garagem"}
    vehicleInfos2 = {"Clique duas vezes no veiculo para retirar/guardar"}
end

addEventHandler("onClientRender", root, function()
    if dashboardOpened then
        --if isChatVisible() then showChat(false) end
        if getElementData(localPlayer, "toggle-->All") then setElementData(localPlayer, "toggle-->All", false) end
        --dxDrawRectangle(startX, startY, width, height, bgColor)

        if currentPage == 1 then
            --- Vehicles
            local sizeX = ((width / 2 - 4 * spacerBig) - 2 * spacerBig) / 3
            local key = 0
            dxDrawText(vehicleInfos[key + 1], startX + 55 * spacerBig + key * (sizeX + spacerBig), startY + 5 * spacerBig, startX + 2 * spacerBig + key * (sizeX + spacerBig) + sizeX, startY + 2 * spacerBig + 30 - spacerBig, tocolor(255, 255, 255), 1, robotoBig, "center", "center")
            dxDrawText(vehicleInfos2[key + 1], startX + 55 * spacerBig + key * (sizeX + spacerBig), startY + 94 * spacerBig, startX + 2 * spacerBig + key * (sizeX + spacerBig) + sizeX, startY + 2 * spacerBig + 30 - spacerBig, tocolor(255, 255, 255), 1, robotoBig2, "center", "center")
            dxDrawRectangle(startX + 2 * spacerBig, startY + 2 * spacerBig + 30, width / 2 - 4 * spacerBig, maxVehicleRows * 22 + spacer, bgColor)
            if #myVehicles > 0 then
                for key = 0, maxVehicleRows - 1 do
                    local forY = startY + 2 * spacerBig + 30 + spacer + key * 22
                    dxDrawRectangle(startX + 2 * spacerBig + spacer, forY, width / 2 - 4 * spacerBig - 2 * spacer, 20, slotColor)
                    if isCursorHover(startX + 2 * spacerBig + spacer, forY, width / 2 - 4 * spacerBig - 2 * spacer, 20) or key == selectedVehicle - currentVehicleRow then
                        dxDrawRectangle(startX + 2 * spacerBig + spacer, forY, width / 2 - 4 * spacerBig - 2 * spacer, 20, hoverColor)
                    end
                end
                lastVehicleRow = currentVehicleRow + maxVehicleRows - 1
                for key, value in ipairs(myVehicles) do
                    if key >= currentVehicleRow and key <= lastVehicleRow then
                        key = key - currentVehicleRow + 1
                        local forY = startY + 2 * spacerBig + 30 + spacer + (key - 1) * 22
                        local statusv = getElementData(localPlayer,"veiculo.garagem", true)
                        local modelo = getElementModel(value)
                        dxDrawText(getVehicleRealName(modelo), startX + 3 * spacerBig + spacer, forY, startX + 3 * spacerBig + spacer + width / 2 - 4 * spacerBig - 2 * spacer, forY + 20, tocolor(255, 255, 255), 1, roboto, "left", "center")
                        dxDrawText("Status: "..math.floor(getElementHealth(value) / 10 + 0.5).."%", startX + 2 * spacerBig + spacer, forY, startX + 2 * spacerBig + spacer + width / 2 - 5 * spacerBig - 2 * spacer, forY + 20, tocolor(255, 255, 255), 1, roboto, "right", "center")

                        if isCursorHover(startX + 2 * spacerBig + spacer, forY, width / 2 - 4 * spacerBig - 2 * spacer, 20) or key == selectedVehicle - currentVehicleRow + 1 then
                            dxDrawText(getVehicleRealName(modelo), startX + 3 * spacerBig + spacer, forY, startX + 3 * spacerBig + spacer + width / 2 - 4 * spacerBig - 2 * spacer, forY + 20, tocolor(0, 0, 0), 1, roboto, "left", "center")
                            dxDrawText("Status: "..math.floor(getElementHealth(value) / 10 + 0.5).."%", startX + 2 * spacerBig + spacer, forY, startX + 2 * spacerBig + spacer + width / 2 - 5 * spacerBig - 2 * spacer, forY + 20, tocolor(0, 0, 0), 1, roboto, "right", "center")
                        end

                    end
                end
            else
                dxDrawText("Nenhum veiculo", startX + 2 * spacerBig + spacerBig, startY + 2 * spacerBig + 30, startX + 2 * spacerBig + spacerBig + width / 2 - 4 * spacerBig, startY + 2 * spacerBig + 30 + maxVehicleRows * 22 + spacer, cancelColor, 1, robotoBig, "center", "center")
            end
            local rightSx = startX + 390 + 4 * spacerBig
        end
    end
end)

function dxDrawButton(text, startX, startY, width, height, color)
    dxDrawRectangle(startX - 1, startY, 1, height, bgColor) --left
    dxDrawRectangle(startX + width, startY, 1, height, bgColor) --right
    dxDrawRectangle(startX - 1, startY - 1, width + 2, 1, bgColor) --top
    dxDrawRectangle(startX - 1, startY + height, width + 2, 1, bgColor) --bottom
    dxDrawRectangle(startX, startY, width, height, color)
    dxDrawText(text, startX, startY, startX + width, startY + height, tocolor(255, 255, 255), 1, roboto, "center", "center", false, false, false, true)
end

function dxDrawEdit(startX, startY, width, height, element)
    dxDrawRectangle(startX - 1, startY, 1, height, bgColor) --left
    dxDrawRectangle(startX + width, startY, 1, height, bgColor) --right
    dxDrawRectangle(startX - 1, startY - 1, width + 2, 1, bgColor) --top
    dxDrawRectangle(startX - 1, startY + height, width + 2, 1, bgColor) --bottom
    dxDrawRectangle(startX, startY, width, height, slotColor)
    dxDrawText(guiGetText(element), startX + 4, startY, startX + width, startY + height, tocolor(255, 255, 255), 1, roboto, "left", "center")
end


function _3DResim(TheElement,Image,distance,height,width,R,G,B,alpha)
        local x, y, z = getElementPosition(TheElement)
        local x2, y2, z2 = getElementPosition(localPlayer)
        local distance = distance or 20
        local height = height or 2
        local width = width or 1
        local checkBuildings = checkBuildings or true
        local checkVehicles = checkVehicles or false
        local checkPeds = checkPeds or false
        local checkObjects = checkObjects or true
        local checkDummies = checkDummies or true
        local seeThroughStuff = seeThroughStuff or false
        local ignoreSomeObjectsForCamera = ignoreSomeObjectsForCamera or false
        local ignoredElement = ignoredElement or nil
        if (isLineOfSightClear(x, y, z, x2, y2, z2, checkBuildings, checkVehicles, checkPeds , checkObjects,checkDummies,seeThroughStuff,ignoreSomeObjectsForCamera,ignoredElement)) then
          local sx, sy = getScreenFromWorldPosition(x, y, z+height)
          if(sx) and (sy) then
            local distanceBetweenPoints = getDistanceBetweenPoints3D(x, y, z, x2, y2, z2)
            if(distanceBetweenPoints < distance) then
              dxDrawMaterialLine3D(x, y, z+1+height-(distanceBetweenPoints/distance), x, y, z+height, Image, width-(distanceBetweenPoints/distance), tocolor(R or 255, G or 255, B or 255, alpha or 255))
            end
          end
      end
  end

  function dxDrawOctagon3D(x, y, z, radius, width, color)
  if type(x) ~= "number" or type(y) ~= "number" or type(z) ~= "number" then
    return false
  end

  local radius = radius or 1
  local radius2 = radius/math.sqrt(2)
  local width = width or 1
  local color = color or tocolor(255,255,255,150)

  point = {}

    for i=1,8 do
      point = {}
    end

    point[1].x = x
    point[1].y = y-radius
    point[2].x = x+radius2
    point[2].y = y-radius2
    point[3].x = x+radius
    point[3].y = y
    point[4].x = x+radius2
    point[4].y = y+radius2
    point[5].x = x
    point[5].y = y+radius
    point[6].x = x-radius2
    point[6].y = y+radius2
    point[7].x = x-radius
    point[7].y = y
    point[8].x = x-radius2
    point[8].y = y-radius2

  for i=1,8 do
    if i ~= 8 then
      x, y, z, x2, y2, z2 = point.x,point.y,z,point[i+1].x,point[i+1].y,z
    else
      x, y, z, x2, y2, z2 = point.x,point.y,z,point[1].x,point[1].y,z
    end
    dxDrawLine3D(x, y, z, x2, y2, z2, color, width)
  end
  return true
end


 

Link to comment
--------------------------------------------------------------
-- © [2019] Varzen Advanced [2019]                        © --
-- © Creditos: Varzen Advanced                            © --
-- © Facebook: https://www.facebook.com/VarzenAdvanced    © --
-- © Youtube: http://www.youtube.com/c/VarzenBR           © --
-- © Blog: https://varzenadvanced.blogspot.com/           © --
--------------------------------------------------------------

addEvent("updateINTDIM2", true)
addEventHandler("updateINTDIM2", getRootElement(), function (vehicleId)
		for index, value in ipairs (getElementsByType("vehicle")) do
			if getElementData(value, "ID") == tonumber(vehicleId) then
				if getElementData(value, "ownercar") == getElementData(source, "ID") then
					setElementInterior(value,0)
					setElementDimension(value,0)
					local x, y, z = getElementPosition(source)
					setElementPosition(value, x, y, z)
					warpPedIntoVehicle(source,value)
			end
		end
	end
end
)

addEvent("guardar", true)
addEventHandler("guardar", getRootElement(), function (vehicleId)
		for index, value in ipairs (getElementsByType("vehicle")) do
			if getElementData(value, "ID") == tonumber(vehicleId) then
				if getElementData(value, "ownercar") == getElementData(source, "ID") then
				local gerarposicao = math.random(50,100)
					setElementPosition(value,1805.39368, -2448.51196, 13.44729)
					setElementInterior(value,gerarposicao)
					setElementDimension(value,gerarposicao)
					outputChatBox("#9ACD32[SRP] #ffffffVeículo Guardado.",source,0,0,0,true)
			end
		end
	end
end
)

addEvent("updateINTDIM22", true)
addEventHandler("updateINTDIM22", getRootElement(), function (vehicleId)
		for index, value in ipairs (getElementsByType("vehicle")) do
			if getElementData(value, "ID") == tonumber(vehicleId) then
				if getElementData(value, "ownercar") == getElementData(source, "ID") then
					setElementInterior(value,0)
					setElementDimension(value,0)
			end
		end
	end
end
)

 

Link to comment

@Tronerboyteste assim:

--------------------------------------------------------------
-- © [2019] Varzen Advanced [2019]                        © --
-- © Creditos: Varzen Advanced                            © --
-- © Facebook: https://www.facebook.com/VarzenAdvanced    © --
-- © Youtube: http://www.youtube.com/c/VarzenBR           © --
-- © Blog: https://varzenadvanced.blogspot.com/           © --
--------------------------------------------------------------

addEvent("updateINTDIM2", true)
addEventHandler("updateINTDIM2", getRootElement(), function (vehicleId)
        for index, value in ipairs (getElementsByType("vehicle")) do
            if getElementData(value, "ID") == tonumber(vehicleId) then
                if getElementData(value, "ownercar") == getElementData(source, "ID") then
                    setElementInterior(value,0)
                    setElementDimension(value,0)
                    local x, y, z = getElementPosition(source)
                    setElementPosition(value, x, y, z)
                    warpPedIntoVehicle(source,value)
            end
        end
    end
end
)

addEvent("guardar", true)
addEventHandler("guardar", getRootElement(), function (vehicleId)
        for index, value in ipairs (getElementsByType("vehicle")) do
            if getElementData(value, "ID") == tonumber(vehicleId) then
                if getElementData(value, "ownercar") == getElementData(source, "ID") then
                local gerarposicao = math.random(50,100)
                    setElementPosition(value,1805.39368, -2448.51196, 13.44729)
                    setElementInterior(value,gerarposicao)
                    setElementDimension(value,gerarposicao)
                    outputChatBox("#9ACD32[SRP] #ffffffVeículo Guardado.",source,0,0,0,true)
            end
        end
    end
end
)

addEvent("updateINTDIM22", true)
addEventHandler("updateINTDIM22", getRootElement(), function (vehicleId)
        for index, value in ipairs (getElementsByType("vehicle")) do
            if getElementData(value, "ID") == tonumber(vehicleId) then
                if getElementData(value, "ownercar") == getElementData(source, "ID") then
                    setElementInterior(value,0)
                    setElementDimension(value,0)
            end
        end
    end
end
)



--------------------
Arquivo Cliente

--------------------------------------------------------------
-- © [2019] Varzen Advanced [2019]                        © --
-- © Creditos: Varzen Advanced                            © --
-- © Facebook: https://www.facebook.com/VarzenAdvanced    © --
-- © Youtube: http://www.youtube.com/c/VarzenBR           © --
-- © Blog: https://varzenadvanced.blogspot.com/           © --
--------------------------------------------------------------

local customCarNames =

{
    {474, "Fusca"},
    {526, "Gol Gts"},
    {410, "Chevette"},
    {436, "Gol G4"},
    {589, "Uno"},
    {600, "Saveiro G7"},
    {400, "EcoEsport"},
    {579, "Fiat Touro"},
    {587, "Bmw M3"},
    {580, "Porsche Cayenne"},
    {506, "Ferrari F430"},
    {603, "Camaro"},
    {451, "Lamborghine Galardo"},
    {439, "Dodge charger"},
    {586, "Titan-160"},
    {468, "XT-660"},
    {521, "XJ6"},
    {581, "S1000"},
    {522, "CB1000"},

}


function getVehicleRealName(model)
    for k, v in ipairs(customCarNames) do
        if v[1] == model then
            return v[2]
        end
    end
    return "Desconhecido"
end

local odimension = getElementDimension(localPlayer)
local ointerior = getElementInterior(localPlayer)
local screenSize = {guiGetScreenSize()}
screenSize.x, screenSize.y = screenSize[1], screenSize[2]
local myScreenSource = dxCreateScreenSource(screenSize.x, screenSize.y)

function infoSound(file)
    playSound("files/sounds/"..file..".mp3")
end

function isCursorHover(startX, startY, sizeX, sizeY)
    if isCursorShowing() then
        local cursorPosition = {getCursorPosition()}
        cursorPosition.x, cursorPosition.y = cursorPosition[1] * screenSize.x, cursorPosition[2] * screenSize.y
        if cursorPosition.x >= startX and cursorPosition.x <= startX + sizeX and cursorPosition.y >= startY and cursorPosition.y <= startY + sizeY then
            return true
        else
            return false
        end
    else
        return false
    end
end

local dashboardOpened = false
local dutyskinOpened = false
local width, height = 800, 450
local startX, startY = (screenSize.x - width) / 2 , (screenSize.y - height) / 2
local bgColor = tocolor(0, 0, 0, 180)
local slotColor = tocolor(40, 40, 40, 200)
local hoverColor = tocolor(154, 205, 50, 180)
local secondColor = tocolor(154, 205, 50, 180)
local cancelColor = tocolor(243, 85, 85, 180)

local spacer = 2
local spacerBig = 5

local roboto = dxCreateFont("files/fonts/Roboto.ttf", 8, false, "proof")
local robotoBold = dxCreateFont("files/fonts/Roboto.ttf", 10, true, "proof")
local robotoBig = dxCreateFont("files/fonts/Roboto.ttf", 11, false, "proof")
local robotoBig2 = dxCreateFont("files/fonts/Roboto.ttf", 10, false, "proof")
local robotoGui = guiCreateFont("files/fonts/Roboto.ttf", 9)

local menuPoints = {{"Propriedade", "property"}}
local menuPointsWidth = (width - (#menuPoints - 1) * spacerBig) / #menuPoints
local playerInfos = {}

local optionsText = {"Ativado"}
optionsText[0] = "Desligado"
local changeTips = {"Desligar"}
changeTips[0] = "Ligar"
local vehicleTuningDatas = {{"engine", "Motor"}, {"turbo", "turbo"}, {"gearbox", "projeto de lei"}, {"ecu", "Ecu"}, {"pneus", "goma"}, {"brakes", "freio"}}
local vehicleTunings = {"#999999Não", "#acd737Rua", "#ffcc00Profissional", "#ff6600Competição", "#ff1a1aEngrenagem" , "#ff1a1aEngrenagem"}
vehicleTunings[0] = "#999999não"


local optionsCreateColor = ""
local optionsCreateText = ""
local maxdistance = 0

local groupMembers = {}
local groupVehicles = {}
local meInGroup = {}

local admins = {}
local openedTick = getTickCount() - 2000

parkYerleri =  {}
park = dxCreateTexture("parking.png")
parkYerleri = createMarker(1457.3518066406, -1783.7336425781, 13.546875-0.95, "cylinder", 2, 0, 176, 196, 10 )
parkYerleri2 = createMarker(1925.9207763672,-1857.4606933594,13.90625-0.95, "cylinder", 2, 0, 176, 196, 10 )
parkYerleri3 = createMarker(-2234.9548339844,2357.5026855469,5-0.95, "cylinder", 2, 0, 176, 196, 10 )
parkYerleri4 = createMarker(1705.2884521484,-1100.5689697266,23.178125, "cylinder", 2, 0, 176, 196, 10 )
parkYerleri5 = createMarker(2544.34, 2880.475, 104.769-0.95, "cylinder", 2, 0, 176, 196, 10 )
parkYerleri6 = createMarker(2814.2902832031, -1539.9907226563, 10.455365180969, "cylinder", 2, 0, 176, 196, 10 )


local myBlip = createBlipAttachedTo ( parkYerleri, 55 )
local myBlip2 = createBlipAttachedTo ( parkYerleri2, 55 )
local myBlip3 = createBlipAttachedTo ( parkYerleri3, 55 )
local myBlip4 = createBlipAttachedTo ( parkYerleri4, 55 )
local myBlip5 = createBlipAttachedTo ( parkYerleri5, 55 )
local myBlip6 = createBlipAttachedTo ( parkYerleri6, 55 )


function parkYeri()

    _3DResim(parkYerleri,park);
    _3DResim(parkYerleri2,park);
    _3DResim(parkYerleri3,park);
    _3DResim(parkYerleri4,park);
    _3DResim(parkYerleri5,park);
    _3DResim(parkYerleri6,park);
end
addEventHandler("onClientRender", getRootElement(), parkYeri)


addEventHandler( "onClientMarkerHit", parkYerleri6,
function ( hitElement, matchingDimension )
   if getElementType(hitElement) == "player" and (hitElement == localPlayer) then
        currentPage = 1
        dashboardOpened = true
        openedTick = getTickCount()
        getMyVehicles()
        maxVehicleRows = 9
        currentVehicleRow = 1
        lastVehicleRow = 1
        selectedVehicle = 1
    end
end
)
addEventHandler( "onClientMarkerLeave", parkYerleri6,
function ( hitElement, matchingDimension )
   if getElementType(hitElement) == "player" and (hitElement == localPlayer) then
    dashboardOpened = false
    end
end
)


addEventHandler( "onClientMarkerHit", parkYerleri5,
function ( hitElement, matchingDimension )
   if getElementType(hitElement) == "player" and (hitElement == localPlayer) then
        currentPage = 1
        dashboardOpened = true
        openedTick = getTickCount()
        getMyVehicles()
        maxVehicleRows = 9
        currentVehicleRow = 1
        lastVehicleRow = 1
        selectedVehicle = 1
    end
end
)
addEventHandler( "onClientMarkerLeave", parkYerleri5,
function ( hitElement, matchingDimension )
   if getElementType(hitElement) == "player" and (hitElement == localPlayer) then
    dashboardOpened = false
    end
end
)


addEventHandler( "onClientMarkerHit", parkYerleri4,
function ( hitElement, matchingDimension )
   if getElementType(hitElement) == "player" and (hitElement == localPlayer) then
        currentPage = 1
        dashboardOpened = true
        openedTick = getTickCount()
        getMyVehicles()
        maxVehicleRows = 9
        currentVehicleRow = 1
        lastVehicleRow = 1
        selectedVehicle = 1
    end
end
)
addEventHandler( "onClientMarkerLeave", parkYerleri4,
function ( hitElement, matchingDimension )
   if getElementType(hitElement) == "player" and (hitElement == localPlayer) then
    dashboardOpened = false
    end
end
)


addEventHandler( "onClientMarkerHit", parkYerleri3,
function ( hitElement, matchingDimension )
   if getElementType(hitElement) == "player" and (hitElement == localPlayer) then
        currentPage = 1
        dashboardOpened = true
        openedTick = getTickCount()
        getMyVehicles()
        maxVehicleRows = 9
        currentVehicleRow = 1
        lastVehicleRow = 1
        selectedVehicle = 1
    end
end
)
addEventHandler( "onClientMarkerLeave", parkYerleri3,
function ( hitElement, matchingDimension )
   if getElementType(hitElement) == "player" and (hitElement == localPlayer) then
    dashboardOpened = false
    end
end
)


addEventHandler( "onClientMarkerHit", parkYerleri2,
function ( hitElement, matchingDimension )
   if getElementType(hitElement) == "player" and (hitElement == localPlayer) then
        currentPage = 1
        dashboardOpened = true
        openedTick = getTickCount()
        getMyVehicles()
        maxVehicleRows = 9
        currentVehicleRow = 1
        lastVehicleRow = 1
        selectedVehicle = 1
    end
end
)
addEventHandler( "onClientMarkerLeave", parkYerleri2,
function ( hitElement, matchingDimension )
   if getElementType(hitElement) == "player" and (hitElement == localPlayer) then
    dashboardOpened = false
    end
end
)

addEventHandler( "onClientMarkerHit", parkYerleri,
function ( hitElement, matchingDimension )
   if getElementType(hitElement) == "player" and (hitElement == localPlayer) then
        currentPage = 1
        dashboardOpened = true
        openedTick = getTickCount()
        getMyVehicles()
        maxVehicleRows = 9
        currentVehicleRow = 1
        lastVehicleRow = 1
        selectedVehicle = 1
    end
end
)
addEventHandler( "onClientMarkerLeave", parkYerleri,
function ( hitElement, matchingDimension )
   if getElementType(hitElement) == "player" and (hitElement == localPlayer) then
    dashboardOpened = false
    end
end
)

addEventHandler("onClientDoubleClick", root, function(button)
    if button == "left" and dashboardOpened and currentPage == 1 then
        local selectedVehicleToGps = false
        lastVehicleRow = currentVehicleRow + maxVehicleRows - 1
        for key, value in ipairs(myVehicles) do
            if key >= currentVehicleRow and key <= lastVehicleRow then
                key = key - currentVehicleRow + 1
                local forY = startY + 2 * spacerBig + 30 + spacer + (key - 1) * 22
                if isCursorHover(startX + 2 * spacerBig + spacer, forY, width / 2 - 4 * spacerBig - 2 * spacer, 20) then
                    selectedVehicleToGps = key + currentVehicleRow - 1
                end
            end
        end

        if tonumber(selectedVehicleToGps) then
            --triggerServerEvent("updateINTDIM2", localPlayer, getElementData(myVehicles[selectedVehicleToGps], "ID"))
            gpsVehicle("gps", getElementData(myVehicles[selectedVehicleToGps], "ID"))
        end
    end
end
)


function gpsVehicle(commandName, vehicleId)
if not vehicleId then
    outputChatBox("#9ACD32[SRP] #ffffffVocê não pode guardar um veículo com placa fria.",0,0,0,true)
    return
end
    if vehicleId then
        for index, value in ipairs (getElementsByType("vehicle")) do
            if getElementData(value, "ID") == tonumber(vehicleId) then
                if not getElementData(value, "ownercar") == getElementData(localPlayer, "ID") then
                   outputChatBox("#9ACD32[SRP] #ffffffVocê não é o dono do veículo!",0,0,0,true)
                   return
                end
                    local counter = 0
                for seat, player in pairs(getVehicleOccupants(value)) do
                counter = counter + 1
                end
                if counter > 0 then outputChatBox("#9ACD32[SRP] #ffffffNão pode guardar com um ocupante.",0,0,0,true)  return
                    end
                    if (getElementDimension(value) == 0) then
                        if not isElementWithinMarker(value, parkYerleri) then return end
                        if not isElementWithinMarker(value, parkYerleri2) then return end
                        if not isElementWithinMarker(value, parkYerleri3) then return end
                        if not isElementWithinMarker(value, parkYerleri4) then return end
                        if not isElementWithinMarker(value, parkYerleri5) then return end
                        if not isElementWithinMarker(value, parkYerleri6) then return end
                        setElementData(value,"veiculo.garagem", true)
                        triggerServerEvent("guardar", localPlayer, vehicleId)
                        return
                    end
                    if (getElementData(value, "detranAP")) then
                        outputChatBox("#9ACD32[SRP] #ffffffSeu veiculo está no detran!",0,0,0,true)
                        triggerServerEvent("updateINTDIM22", localPlayer, vehicleId)
                    else
                    triggerServerEvent("updateINTDIM2", localPlayer, vehicleId)
                    outputChatBox("#9ACD32[SRP] #ffffffVeiculo retirado.",0,0,0,true)
                    setElementData(value,"veiculo.garagem", false)
                 end
            end
        end
    end
end


addEventHandler("onClientKey", root, function(button, pressed)
    if pressed and getElementData(localPlayer, "CharLoggedIn") then
        --if button == "F4" then
            --changeState()
            --cancelEvent()
        --end
        if dashboardOpened then
            if currentPage == 1 then
                if isCursorHover(startX + 2 * spacerBig, startY + 2 * spacerBig + 30, width / 2 - 4 * spacerBig, maxVehicleRows * 22 + spacer) then
                    if button == "mouse_wheel_down" then
                        if currentVehicleRow < #myVehicles - (maxVehicleRows - 1) then
                            currentVehicleRow = currentVehicleRow + 1
                        end
                    elseif button == "mouse_wheel_up" then
                        if currentVehicleRow > 1 then
                            currentVehicleRow = currentVehicleRow - 1
                        end
                    elseif button == "mouse1" then
                        lastVehicleRow = currentVehicleRow + maxVehicleRows - 1
                        for key, value in ipairs(myVehicles) do
                            if key >= currentVehicleRow and key <= lastVehicleRow then
                                key = key - currentVehicleRow + 1
                                local forY = startY + 2 * spacerBig + 30 + spacer + (key - 1) * 22
                                if isCursorHover(startX + 2 * spacerBig + spacer, forY, width / 2 - 4 * spacerBig - 2 * spacer, 20) then
                                    selectedVehicle = key + currentVehicleRow - 1
                                end
                            end
                        end
                    end
                end

            end
        end
    end
end
)

addEventHandler("onClientElementDataChange", root, function(dataName, oldValue)
    if source and getElementType(source) == "player" then
        if source == localPlayer then
            if dataName == "char:vehSlot" then
                getMyVehicles()
        end
    end
    end
end)

function thousandsStepper(amount)
    local formatted = amount
    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 getMyVehicles()
    myVehicles = {}
    for key, value in ipairs(getElementsByType("vehicle")) do
        if getElementData(value,"ownercar") == getElementData(localPlayer,"ID") then
            table.insert(myVehicles, value)
        end
    end
    vehicleInfos = {"Solaria RolePlay - Garagem"}
    vehicleInfos2 = {"Clique duas vezes no veiculo para retirar/guardar"}
end

addEventHandler("onClientRender", root, function()
    if dashboardOpened then
        --if isChatVisible() then showChat(false) end
        if getElementData(localPlayer, "toggle-->All") then setElementData(localPlayer, "toggle-->All", false) end
        --dxDrawRectangle(startX, startY, width, height, bgColor)

        if currentPage == 1 then
            --- Vehicles
            local sizeX = ((width / 2 - 4 * spacerBig) - 2 * spacerBig) / 3
            local key = 0
            dxDrawText(vehicleInfos[key + 1], startX + 55 * spacerBig + key * (sizeX + spacerBig), startY + 5 * spacerBig, startX + 2 * spacerBig + key * (sizeX + spacerBig) + sizeX, startY + 2 * spacerBig + 30 - spacerBig, tocolor(255, 255, 255), 1, robotoBig, "center", "center")
            dxDrawText(vehicleInfos2[key + 1], startX + 55 * spacerBig + key * (sizeX + spacerBig), startY + 94 * spacerBig, startX + 2 * spacerBig + key * (sizeX + spacerBig) + sizeX, startY + 2 * spacerBig + 30 - spacerBig, tocolor(255, 255, 255), 1, robotoBig2, "center", "center")
            dxDrawRectangle(startX + 2 * spacerBig, startY + 2 * spacerBig + 30, width / 2 - 4 * spacerBig, maxVehicleRows * 22 + spacer, bgColor)
            if #myVehicles > 0 then
                for key = 0, maxVehicleRows - 1 do
                    local forY = startY + 2 * spacerBig + 30 + spacer + key * 22
                    dxDrawRectangle(startX + 2 * spacerBig + spacer, forY, width / 2 - 4 * spacerBig - 2 * spacer, 20, slotColor)
                    if isCursorHover(startX + 2 * spacerBig + spacer, forY, width / 2 - 4 * spacerBig - 2 * spacer, 20) or key == selectedVehicle - currentVehicleRow then
                        dxDrawRectangle(startX + 2 * spacerBig + spacer, forY, width / 2 - 4 * spacerBig - 2 * spacer, 20, hoverColor)
                    end
                end
                lastVehicleRow = currentVehicleRow + maxVehicleRows - 1
                for key, value in ipairs(myVehicles) do
                    if key >= currentVehicleRow and key <= lastVehicleRow then
                        key = key - currentVehicleRow + 1
                        local forY = startY + 2 * spacerBig + 30 + spacer + (key - 1) * 22
                        local statusv = getElementData(localPlayer,"veiculo.garagem", true)
                        local modelo = getElementModel(value)
                        dxDrawText(getVehicleRealName(modelo), startX + 3 * spacerBig + spacer, forY, startX + 3 * spacerBig + spacer + width / 2 - 4 * spacerBig - 2 * spacer, forY + 20, tocolor(255, 255, 255), 1, roboto, "left", "center")
                        dxDrawText("Status: "..math.floor(getElementHealth(value) / 10 + 0.5).."%", startX + 2 * spacerBig + spacer, forY, startX + 2 * spacerBig + spacer + width / 2 - 5 * spacerBig - 2 * spacer, forY + 20, tocolor(255, 255, 255), 1, roboto, "right", "center")

                        if isCursorHover(startX + 2 * spacerBig + spacer, forY, width / 2 - 4 * spacerBig - 2 * spacer, 20) or key == selectedVehicle - currentVehicleRow + 1 then
                            dxDrawText(getVehicleRealName(modelo), startX + 3 * spacerBig + spacer, forY, startX + 3 * spacerBig + spacer + width / 2 - 4 * spacerBig - 2 * spacer, forY + 20, tocolor(0, 0, 0), 1, roboto, "left", "center")
                            dxDrawText("Status: "..math.floor(getElementHealth(value) / 10 + 0.5).."%", startX + 2 * spacerBig + spacer, forY, startX + 2 * spacerBig + spacer + width / 2 - 5 * spacerBig - 2 * spacer, forY + 20, tocolor(0, 0, 0), 1, roboto, "right", "center")
                        end

                    end
                end
            else
                dxDrawText("Nenhum veiculo", startX + 2 * spacerBig + spacerBig, startY + 2 * spacerBig + 30, startX + 2 * spacerBig + spacerBig + width / 2 - 4 * spacerBig, startY + 2 * spacerBig + 30 + maxVehicleRows * 22 + spacer, cancelColor, 1, robotoBig, "center", "center")
            end
            local rightSx = startX + 390 + 4 * spacerBig
        end
    end
end)

function dxDrawButton(text, startX, startY, width, height, color)
    dxDrawRectangle(startX - 1, startY, 1, height, bgColor) --left
    dxDrawRectangle(startX + width, startY, 1, height, bgColor) --right
    dxDrawRectangle(startX - 1, startY - 1, width + 2, 1, bgColor) --top
    dxDrawRectangle(startX - 1, startY + height, width + 2, 1, bgColor) --bottom
    dxDrawRectangle(startX, startY, width, height, color)
    dxDrawText(text, startX, startY, startX + width, startY + height, tocolor(255, 255, 255), 1, roboto, "center", "center", false, false, false, true)
end

function dxDrawEdit(startX, startY, width, height, element)
    dxDrawRectangle(startX - 1, startY, 1, height, bgColor) --left
    dxDrawRectangle(startX + width, startY, 1, height, bgColor) --right
    dxDrawRectangle(startX - 1, startY - 1, width + 2, 1, bgColor) --top
    dxDrawRectangle(startX - 1, startY + height, width + 2, 1, bgColor) --bottom
    dxDrawRectangle(startX, startY, width, height, slotColor)
    dxDrawText(guiGetText(element), startX + 4, startY, startX + width, startY + height, tocolor(255, 255, 255), 1, roboto, "left", "center")
end


function _3DResim(TheElement,Image,distance,height,width,R,G,B,alpha)
        local x, y, z = getElementPosition(TheElement)
        local x2, y2, z2 = getElementPosition(localPlayer)
        local distance = distance or 20
        local height = height or 2
        local width = width or 1
        local checkBuildings = checkBuildings or true
        local checkVehicles = checkVehicles or false
        local checkPeds = checkPeds or false
        local checkObjects = checkObjects or true
        local checkDummies = checkDummies or true
        local seeThroughStuff = seeThroughStuff or false
        local ignoreSomeObjectsForCamera = ignoreSomeObjectsForCamera or false
        local ignoredElement = ignoredElement or nil
        if (isLineOfSightClear(x, y, z, x2, y2, z2, checkBuildings, checkVehicles, checkPeds , checkObjects,checkDummies,seeThroughStuff,ignoreSomeObjectsForCamera,ignoredElement)) then
          local sx, sy = getScreenFromWorldPosition(x, y, z+height)
          if(sx) and (sy) then
            local distanceBetweenPoints = getDistanceBetweenPoints3D(x, y, z, x2, y2, z2)
            if(distanceBetweenPoints < distance) then
              dxDrawMaterialLine3D(x, y, z+1+height-(distanceBetweenPoints/distance), x, y, z+height, Image, width-(distanceBetweenPoints/distance), tocolor(R or 255, G or 255, B or 255, alpha or 255))
            end
          end
      end
  end

  function dxDrawOctagon3D(x, y, z, radius, width, color)
  if type(x) ~= "number" or type(y) ~= "number" or type(z) ~= "number" then
    return false
  end

  local radius = radius or 1
  local radius2 = radius/math.sqrt(2)
  local width = width or 1
  local color = color or tocolor(255,255,255,150)

  point = {}

    for i=1,8 do
      point = {}
    end

    point[1].x = x
    point[1].y = y-radius
    point[2].x = x+radius2
    point[2].y = y-radius2
    point[3].x = x+radius
    point[3].y = y
    point[4].x = x+radius2
    point[4].y = y+radius2
    point[5].x = x
    point[5].y = y+radius
    point[6].x = x-radius2
    point[6].y = y+radius2
    point[7].x = x-radius
    point[7].y = y
    point[8].x = x-radius2
    point[8].y = y-radius2

  for i=1,8 do
    if i ~= 8 then
      x, y, z, x2, y2, z2 = point.x,point.y,z,point[i+1].x,point[i+1].y,z
    else
      x, y, z, x2, y2, z2 = point.x,point.y,z,point[1].x,point[1].y,z
    end
    dxDrawLine3D(x, y, z, x2, y2, z2, color, width)
  end
  return true
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...