Sucrilhex Posted June 24, 2020 Share Posted June 24, 2020 local screenW,screenH = guiGetScreenSize() local resW,resH = 1366,768 local x,y = (screenW/resW), (screenH/resH) DGS = exports.Res_dgs local Font_1 = dxCreateFont("font/font.ttf", y*11) local Font_2 = dxCreateFont("font/font1.ttf", y*11) local Font_3 = dxCreateFont("font/fontNick.ttf", y*11) local Font_4 = dxCreateFont("font/OpenSans-Bold.ttf", y*14) function Abrir_Garagem() if getElementInterior(localPlayer) == 0 and getElementDimension(localPlayer) == 0 then if not isEventHandlerAdded("onClientRender", getRootElement(), Dx_Garagem) then showCursor(true) DGS:dgsSetVisible(SeusCarros, true) addEventHandler("onClientRender", root, Dx_Garagem) end end end addEvent("DNL:Abrir(Garagem)", true) addEventHandler("DNL:Abrir(Garagem)", root, Abrir_Garagem) function Fechar_Garagem() if getElementInterior(localPlayer) == 0 and getElementDimension(localPlayer) == 0 then if isEventHandlerAdded("onClientRender", getRootElement(), Dx_Garagem) then showCursor(false) DGS:dgsSetVisible(SeusCarros, false) removeEventHandler("onClientRender", root, Dx_Garagem) end end end addEvent("DNL:Fechar(Garagem)", true) addEventHandler("DNL:Fechar(Garagem)", root, Fechar_Garagem) --=============================-- ---------- Dx Garagem ----------- --=============================-- function Dx_Garagem() -- exports["Ad-Blur"]:dxDrawBluredRectangle(x*500, y*193, x*366, y*450, tocolor(255, 255, 255, 255)) dxDrawRectangle(x*500, y*193, x*366, y*450, tocolor(200, 200, 200, 180), false) dxDrawRectangle(x*500, y*193, x*366, y*58, tocolor(0, 0, 0, 222), false) dxDrawLine(x*500, y*251, x*866, y*251, tocolor(0, 60, 160, 200), 2, false) dxDrawLine(x*500, y*482, x*866, y*482, tocolor(0, 60, 160, 200), 2, false) contornoRetangulo(x*500, y*193, x*366, y*450, tocolor(0, 0, 0, 222), x*1) -- Line enfeite dxDrawText("Garagem", x*643, y*210, x*724, y*234, tocolor(255, 255, 255, 255), 1, Font_4, "left", "top", false, false, false, false, false) dxDrawImage(x*602, y*493, x*162, y*40, "Img/botao.png", 0, 0, 0, CorPuxar, false) dxDrawText("Puxar", x*665, y*503, x*702, y*521, tocolor(0, 0, 0, 255), 1, Font_3, "left", "top", false, false, false, false, false) CorPuxar = tocolor(0, 60, 160, 200) if isCursorOnElement(x*602, y*493, x*162, y*40) then CorPuxar = tocolor(0, 60, 160, 255) end dxDrawImage(x*602, y*543, x*162, y*40, "Img/botao.png", 0, 0, 0, CorGuardar, false) dxDrawText("Guardar", x*658, y*553, x*710, y*571, tocolor(0, 0, 0, 255), 1, Font_3, "left", "top", false, false, false, false, false) CorGuardar = tocolor(0, 60, 160, 200) if isCursorOnElement(x*602, y*543, x*162, y*40) then CorGuardar = tocolor(0, 60, 160, 255) end dxDrawImage(x*602, y*593, x*162, y*40, "Img/botao.png", 0, 0, 0, CorSpawnar, false) dxDrawText("Spawnar", x*657, y*603, x*713, y*621, tocolor(0, 0, 0, 255), 1, Font_3, "left", "top", false, false, false, false, false) CorSpawnar = tocolor(0, 60, 160, 200) if isCursorOnElement(x*602, y*593, x*162, y*40) then CorSpawnar = tocolor(0, 60, 160, 255) end dxDrawText("X", x*835, y*210, x*724, y*234, CorClose, 1, Font_4, "left", "top", false, false, false, false, false) CorClose = tocolor(100, 100, 100, 255) if isCursorOnElement(x*835, y*210, x*17, y*17) then CorClose = tocolor(255, 0, 0, 255) end end --addEventHandler("onClientRender", root, Dx_Garagem) --=============================-- ---------- AddCar_List ---------- --=============================-- SeusCarros = DGS:dgsCreateGridList(x*500, y*231, x*366, y*232,false) DGS:dgsGridListAddColumn(SeusCarros,"", 1) DGS:dgsSetVisible(SeusCarros, false) function Refresh_Lista() local data = getElementData(localPlayer, "VehicleInfo") if data then DGS:dgsGridListClearRow(SeusCarros) for i, data in ipairs (data) do -- local = getVehicleNameFromModel(data["Model"]) local ID = data["ID"] local NameCarro = Lista_Veiculos:GetItemDetails(1, Lista_Veiculos:GetSelectedItem()) local row = DGS:dgsGridListAddRow(SeusCarros) DGS:dgsGridListSetItemText(SeusCarros, row, 1, NameCarro, false, true) DGS:dgsGridListSetItemData(SeusCarros, row, 1, ID) end end end addEventHandler("onClientElementDataChange", root, function(dd) if getElementType(source) == "player" and source == localPlayer and dd == "VehicleInfo" then local data = getElementData(source, dd) if data then Refresh_Lista() end end end) --=============================-- ---------- ClickListCar --------- --=============================-- function Clicks_Garagem ( _,state ) local id = DGS:dgsGridListGetSelectedItem(SeusCarros) local ID = DGS:dgsGridListGetItemData(SeusCarros, id, 1) if isEventHandlerAdded("onClientRender", getRootElement(), Dx_Garagem) then if isCursorOnElement ( x*835, y*210, x*17, y*17 ) then playSoundFrontEnd(8) Fechar_Garagem () end if state == "down" then if (id ~= -1) then if isCursorOnElement ( x*602, y*493, x*162, y*40 ) then playSoundFrontEnd(2) triggerServerEvent("DNL:Trazer_Veh", root, localPlayer, ID) elseif isCursorOnElement ( x*602, y*543, x*162, y*40 ) then playSoundFrontEnd(2) triggerServerEvent("DNL:Guardar_Veh", root, localPlayer, ID) elseif isCursorOnElement ( x*602, y*593, x*162, y*40 ) then playSoundFrontEnd(2) triggerServerEvent("DNL:Spawnar_Veh", root, localPlayer, ID) end end end end end addEventHandler ( "onClientClick", root, Clicks_Garagem ) --=============================-- ------------- IGNORA ------------ --=============================-- AllKeys = { "arrow_l", "arrow_u", "arrow_r", "arrow_d", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "u", "v", "w", "x", "y", "z", "num_0", "num_1", "num_2", "num_3", "num_4", "num_5", "num_6", "num_7", "num_8", "num_9", "num_mul", "num_add", "num_sep", "num_sub", "num_div", "num_dec", "num_enter", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12", "escape", "backspace", "tab", "lalt", "ralt", "enter", "space", "pgup", "pgdn", "end", "home", "insert", "delete", "lshift", "rshift", "lctrl", "rctrl", "[", "]", "pause", "capslock", "scroll", ";", ",", "-", ".", "/", "#", "\\", "=" } addEventHandler("onClientKey", root, function(button, press) for index, keys in pairs(AllKeys) do if isEventHandlerAdded("onClientRender", getRootElement(), Dx_Garagem) then if button == keys then cancelEvent() end end end end ) function dxDrawBorderedText( text, x, y, w, h, color, scale, font, alignX, alignY, clip, wordBreak, postGUI ) dxDrawText ( text, x - 1, y, w - 1, h, color, scale, font, alignX, alignY, clip, wordBreak, false ) dxDrawText ( text, x + 1, y, w + 1, h, color, scale, font, alignX, alignY, clip, wordBreak, false ) dxDrawText ( text, x, y - 1, w, h - 1, color, scale, font, alignX, alignY, clip, wordBreak, false ) dxDrawText ( text, x, y + 1, w, h + 1, color, scale, font, alignX, alignY, clip, wordBreak, false ) dxDrawText ( text, x, y, w, h, color, scale, font, alignX, alignY, clip, wordBreak, postGUI ) end function contornoRetangulo(absX, absY, sizeX, sizeY, color, ancho) dxDrawRectangle(absX, absY, sizeX, ancho, color) dxDrawRectangle(absX, absY + ancho, ancho, sizeY - ancho, color) dxDrawRectangle(absX + ancho, absY + sizeY - ancho, sizeX - ancho, ancho, color) dxDrawRectangle(absX + sizeX - ancho, absY + ancho, ancho, sizeY - ancho*2, color) end function isEventHandlerAdded( sEventName, pElementAttachedTo, func ) if type( sEventName ) == 'string' and isElement( pElementAttachedTo ) and type( func ) == 'function' then local aAttachedFunctions = getEventHandlers( sEventName, pElementAttachedTo ) if type( aAttachedFunctions ) == 'table' and #aAttachedFunctions > 0 then for i, v in ipairs( aAttachedFunctions ) do if v == func then return true end end end end return false end local x,y = guiGetScreenSize() function isCursorOnElement(x, y, w, h) if (not isCursorShowing()) then return false end local mx, my = getCursorPosition() local fullx, fully = guiGetScreenSize() cursorx, cursory = mx*fullx, my*fully if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then return true else return false end end o nome fica duplicado na garagem da concessionária, linha 85 até 99 quando eu pego um veiculo o nome funciona normal, porem quando pego outro, todos ficam o mesmo nome do veiculo que peguei por ultimo Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now