viniciuss Posted April 27, 2022 Share Posted April 27, 2022 tenho um sistema de gasolina e um mod de concessionária no meu servidor, está funcionando perfeitamente mas sempre que eu guardo o carro na garagem e depois tiro ele volta com 100% de gasolina ao invés de voltar como estava. NAO SEI COMO ARRUMAR ISSO. CLIENT.LUA local screenW, screenH = guiGetScreenSize() local x, y = (screenW/1366), (screenH/768) local dxfont0_icons = dxCreateFont("font/icons.ttf", x*12) local dxfont1_icons = dxCreateFont("font/icons.ttf", x*10) local dxfont0_OpenSans_Bold = dxCreateFont("font/OpenSans-Bold.ttf", x*12) local dxfont1_OpenSans_Bold = dxCreateFont("font/OpenSans-Bold.ttf", y*11) local RGEnviar = createElement("TS:EditBox_LojaCarrosBMV") painel = false painel2 = false Veiculo = {} --[[ ><><><><><><><><><><><><><><><><><><><>< ><Painel Inicial>< ><><><><><><><><><><><><><><><><><><><>< --]] function cancelDamage() if getElementData (source, "Imortal") == true then -- Se o NPC que foi atacado tiver a data "imortal", então cancela o dano nele. cancelEvent() end end addEventHandler ("onClientPedDamage", root, cancelDamage) function PainelLojaCarros () -- exports["Blur"]:dxDrawBluredRectangle(screenW * 0.7725, screenH * 0.1978, screenW * 0.2181, screenH * 0.7189, tocolor(255, 255, 255, 230)) dxDrawRectangle(screenW * 0.7725, screenH * 0.1978, screenW * 0.2181, screenH * 0.7189, tocolor(0, 0, 0, 148), false) dxDrawRectangle(screenW * 0.7725, screenH * 0.1978, screenW * 0.2181, screenH * 0.0578, tocolor(0, 0, 0, 189), false) dxDrawLine(screenW * 0.7725, screenH * 0.2556, screenW * 0.9906, screenH * 0.2556, tocolor(255,0,0, 255), 3, false) dxDrawText("Loja de Veiculos", screenW * 0.7725, screenH * 0.1978, screenW * 0.9906, screenH * 0.2556, tocolor(255, 255, 255, 255), 1.00, dxfont0_icons, "center", "center", false, false, false, false, false) dxDrawLine((screenW * 0.7875) - 1, (screenH * 0.6000) - 1, (screenW * 0.7875) - 1, screenH * 0.6456, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(screenW * 0.8169, (screenH * 0.6000) - 1, (screenW * 0.7875) - 1, (screenH * 0.6000) - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawLine((screenW * 0.7875) - 1, screenH * 0.6456, screenW * 0.8169, screenH * 0.6456, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(screenW * 0.8169, screenH * 0.6456, screenW * 0.8169, (screenH * 0.6000) - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawRectangle(screenW * 0.7875, screenH * 0.6000, screenW * 0.0294, screenH * 0.0456, tocolor(255, 255, 255, 255), false) dxDrawLine((screenW * 0.8256) - 1, (screenH * 0.6000) - 1, (screenW * 0.8256) - 1, screenH * 0.6456, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(screenW * 0.8550, (screenH * 0.6000) - 1, (screenW * 0.8256) - 1, (screenH * 0.6000) - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawLine((screenW * 0.8256) - 1, screenH * 0.6456, screenW * 0.8550, screenH * 0.6456, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(screenW * 0.8550, screenH * 0.6456, screenW * 0.8550, (screenH * 0.6000) - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawRectangle(screenW * 0.8256, screenH * 0.6000, screenW * 0.0294, screenH * 0.0456, tocolor(0, 0, 0, 255), false) dxDrawLine((screenW * 0.8638) - 1, (screenH * 0.6000) - 1, (screenW * 0.8638) - 1, screenH * 0.6456, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(screenW * 0.8931, (screenH * 0.6000) - 1, (screenW * 0.8638) - 1, (screenH * 0.6000) - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawLine((screenW * 0.8638) - 1, screenH * 0.6456, screenW * 0.8931, screenH * 0.6456, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(screenW * 0.8931, screenH * 0.6456, screenW * 0.8931, (screenH * 0.6000) - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawRectangle(screenW * 0.8638, screenH * 0.6000, screenW * 0.0294, screenH * 0.0456, tocolor(0, 28, 241, 255), false) dxDrawLine((screenW * 0.9019) - 1, (screenH * 0.6000) - 1, (screenW * 0.9019) - 1, screenH * 0.6456, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(screenW * 0.9313, (screenH * 0.6000) - 1, (screenW * 0.9019) - 1, (screenH * 0.6000) - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawLine((screenW * 0.9019) - 1, screenH * 0.6456, screenW * 0.9313, screenH * 0.6456, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(screenW * 0.9313, screenH * 0.6456, screenW * 0.9313, (screenH * 0.6000) - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawRectangle(screenW * 0.9019, screenH * 0.6000, screenW * 0.0294, screenH * 0.0456, tocolor(34, 240, 0, 255), false) dxDrawLine((screenW * 0.9400) - 1, (screenH * 0.6000) - 1, (screenW * 0.9400) - 1, screenH * 0.6456, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(screenW * 0.9694, (screenH * 0.6000) - 1, (screenW * 0.9400) - 1, (screenH * 0.6000) - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawLine((screenW * 0.9400) - 1, screenH * 0.6456, screenW * 0.9694, screenH * 0.6456, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(screenW * 0.9694, screenH * 0.6456, screenW * 0.9694, (screenH * 0.6000) - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawRectangle(screenW * 0.9400, screenH * 0.6000, screenW * 0.0294, screenH * 0.0456, tocolor(239, 0, 5, 255), false) if isCursorOnElement(screenW * 0.7788, screenH * 0.6567, screenW * 0.2013, screenH * 0.0522) then dxDrawImage(screenW * 0.7788, screenH * 0.6567, screenW * 0.2013, screenH * 0.0522, "botao.png", 0, 0, 0, tocolor(255,0,0, 255), false) else dxDrawImage(screenW * 0.7788, screenH * 0.6567, screenW * 0.2013, screenH * 0.0522, "botao.png", 0, 0, 0, tocolor(255,0,0, 120), false) end if isCursorOnElement(screenW * 0.7788, screenH * 0.7200, screenW * 0.2013, screenH * 0.0522) then dxDrawImage(screenW * 0.7788, screenH * 0.7200, screenW * 0.2013, screenH * 0.0522, "botao.png", 0, 0, 0, tocolor(255,0,0, 255), false) else dxDrawImage(screenW * 0.7788, screenH * 0.7200, screenW * 0.2013, screenH * 0.0522, "botao.png", 0, 0, 0, tocolor(255,0,0, 120), false) end if isCursorOnElement(screenW * 0.7788, screenH * 0.7833, screenW * 0.2013, screenH * 0.0522) then dxDrawImage(screenW * 0.7788, screenH * 0.7833, screenW * 0.2013, screenH * 0.0522, "botao.png", 0, 0, 0, tocolor(255,0,0, 255), false) else dxDrawImage(screenW * 0.7788, screenH * 0.7833, screenW * 0.2013, screenH * 0.0522, "botao.png", 0, 0, 0, tocolor(255,0,0, 120), false) end if isCursorOnElement(screenW * 0.7788, screenH * 0.8467, screenW * 0.2013, screenH * 0.0522) then dxDrawImage(screenW * 0.7788, screenH * 0.8467, screenW * 0.2013, screenH * 0.0522, "botao.png", 0, 0, 0, tocolor(255,0,0, 255), false) else dxDrawImage(screenW * 0.7788, screenH * 0.8467, screenW * 0.2013, screenH * 0.0522, "botao.png", 0, 0, 0, tocolor(255,0,0, 120), false) end dxDrawText("Olhar Veiculo", screenW * 0.7788, screenH * 0.6567, screenW * 0.9800, screenH * 0.7089, tocolor(255, 255, 255, 255), 1.00, dxfont0_icons, "center", "center", false, false, false, false, false) dxDrawText("Comprar Veiculo", screenW * 0.7788, screenH * 0.7200, screenW * 0.9800, screenH * 0.7722, tocolor(255, 255, 255, 255), 1.00, dxfont0_icons, "center", "center", false, false, false, false, false) dxDrawText("Alugar Veiculo", screenW * 0.7788, screenH * 0.7833, screenW * 0.9800, screenH * 0.8356, tocolor(255, 255, 255, 255), 1.00, dxfont0_icons, "center", "center", false, false, false, false, false) dxDrawText("Fechar Painel", screenW * 0.7788, screenH * 0.8467, screenW * 0.9800, screenH * 0.8989, tocolor(255, 255, 255, 255), 1.00, dxfont0_icons, "center", "center", false, false, false, false, false) end function DocumentoVeiculo () local VeiculoDentro = getPedOccupiedVehicle(localPlayer) local NomeVeiculo = getVehicleName ( VeiculoDentro ) local IDVeiculo = getVehicleIDFromName(NomeVeiculo) local NomeVeic = getElementData(VeiculoDentro, "TS:NomeCarro") or getVehicleNameFromModel (IDVeiculo) local Dono = getElementData(VeiculoDentro, "TS:Dono") or "Governo" local RGDono = getElementData(VeiculoDentro, "TS:RGDono") or "Error" local Placa = getVehiclePlateText ( VeiculoDentro ) local Ocorrencia = getElementData(VeiculoDentro, "TS:Roubado") or false local Gasolina = getElementData(VeiculoDentro, "fuel") or 0 dxDrawImage(screenW * 0.3470, screenH * 0.1836, screenW * 0.3060, screenH * 0.6341, "doc.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawText(Dono, screenW * 0.3990, screenH * 0.3346, screenW * 0.6201, screenH * 0.3854, tocolor(0, 0, 0, 255), 1.00, dxfont0_icons, "center", "center", false, false, false, true, false) dxDrawText(RGDono, screenW * 0.3990, screenH * 0.4245, screenW * 0.5168, screenH * 0.4609, tocolor(0, 0, 0, 255), 1.00, dxfont0_icons, "center", "center", false, false, false, true, false) dxDrawText(Placa, screenW * 0.5351, screenH * 0.4245, screenW * 0.6237, screenH * 0.4609, tocolor(0, 0, 0, 255), 1.00, dxfont0_icons, "center", "center", false, false, false, true, false) dxDrawText("9BW ZZZ377 VT 004251", screenW * 0.3960, screenH * 0.4857, screenW * 0.6237, screenH * 0.5221, tocolor(0, 0, 0, 255), 1.00, dxfont0_icons, "center", "center", false, false, false, true, false) dxDrawText(NomeVeic, screenW * 0.4004, screenH * 0.5547, screenW * 0.5066, screenH * 0.5911, tocolor(0, 0, 0, 255), 1.00, dxfont0_icons, "center", "center", false, false, false, true, false) if Ocorrencia == true then dxDrawText("#FF0000ROUBADO", screenW * 0.5205, screenH * 0.5547, screenW * 0.6266, screenH * 0.5911, tocolor(255, 255, 255, 255), 1.00, dxfont0_icons, "center", "center", false, false, false, true, false) else dxDrawText("#00FF00SEM QUEIXA", screenW * 0.5205, screenH * 0.5547, screenW * 0.6266, screenH * 0.5911, tocolor(255, 255, 255, 255), 1.00, dxfont0_icons, "center", "center", false, false, false, true, false) end dxDrawText(Gasolina.." %", screenW * 0.4078, screenH * 0.6263, screenW * 0.5139, screenH * 0.6628, tocolor(0, 0, 0, 255), 1.00, dxfont0_icons, "center", "center", false, false, false, true, false) dxDrawText("30/12/2022", screenW * 0.5395, screenH * 0.6263, screenW * 0.6230, screenH * 0.6628, tocolor(0, 0, 0, 255), 1.00, dxfont0_icons, "center", "center", false, false, false, true, false) end function PainelLojaCarros2 () exports["Blur"]:dxDrawBluredRectangle(screenW * 0.2175, screenH * 0.2122, screenW * 0.2350, screenH * 0.5067, tocolor(255, 255, 255, 230)) dxDrawRectangle(screenW * 0.2175, screenH * 0.2122, screenW * 0.2350, screenH * 0.5067, tocolor(0, 0, 0, 114), false) dxDrawRectangle(screenW * 0.2175, screenH * 0.2122, screenW * 0.2350, screenH * 0.0567, tocolor(0, 0, 0, 175), false) dxDrawLine(screenW * 0.2175, screenH * 0.2689, screenW * 0.4525, screenH * 0.2689, tocolor(255,0,0, 255), 3, false) dxDrawText("Garagem De Veiculos", screenW * 0.2175, screenH * 0.2122, screenW * 0.4525, screenH * 0.2689, tocolor(255, 255, 255, 255), 1.00, dxfont0_icons, "center", "center", false, false, true, false, false) if isCursorOnElement(screenW * 0.2219, screenH * 0.5233, screenW * 0.2213, screenH * 0.0522) then dxDrawImage(screenW * 0.2219, screenH * 0.5233, screenW * 0.2213, screenH * 0.0522, "botao.png", 0, 0, 0, tocolor(255,0,0, 255), false) else dxDrawImage(screenW * 0.2219, screenH * 0.5233, screenW * 0.2213, screenH * 0.0522, "botao.png", 0, 0, 0, tocolor(255,0,0, 120), false) end if isCursorOnElement(screenW * 0.2219, screenH * 0.5867, screenW * 0.2213, screenH * 0.0522) then dxDrawImage(screenW * 0.2219, screenH * 0.5867, screenW * 0.2213, screenH * 0.0522, "botao.png", 0, 0, 0, tocolor(255,0,0, 255), false) else dxDrawImage(screenW * 0.2219, screenH * 0.5867, screenW * 0.2213, screenH * 0.0522, "botao.png", 0, 0, 0, tocolor(255,0,0, 120), false) end if isCursorOnElement(screenW * 0.2219, screenH * 0.6500, screenW * 0.2213, screenH * 0.0522) then dxDrawImage(screenW * 0.2219, screenH * 0.6500, screenW * 0.2213, screenH * 0.0522, "botao.png", 0, 0, 0, tocolor(255,0,0, 255), false) else dxDrawImage(screenW * 0.2219, screenH * 0.6500, screenW * 0.2213, screenH * 0.0522, "botao.png", 0, 0, 0, tocolor(255,0,0, 120), false) end dxDrawText("Pegar Veiculo", screenW * 0.2219, screenH * 0.5233, screenW * 0.4431, screenH * 0.5756, tocolor(255, 255, 255, 255), 1.00, dxfont0_icons, "center", "center", false, false, false, false, false) dxDrawText("Guardar Veiculo", screenW * 0.2219, screenH * 0.5867, screenW * 0.4431, screenH * 0.6389, tocolor(255, 255, 255, 255), 1.00, dxfont0_icons, "center", "center", false, false, false, false, false) dxDrawText("Fechar Painel", screenW * 0.2219, screenH * 0.6500, screenW * 0.4431, screenH * 0.7022, tocolor(255, 255, 255, 255), 1.00, dxfont0_icons, "center", "center", false, false, false, false, false) end painelpresentear = false function PainelEnviar () exports["Blur"]:dxDrawBluredRectangle(screenW * 0.0205, screenH * 0.2604, screenW * 0.2130, screenH * 0.3555, tocolor(255, 255, 255, 230)) dxDrawRectangle(screenW * 0.0205, screenH * 0.2604, screenW * 0.2130, screenH * 0.3555, tocolor(0, 0, 0, 135), false) dxDrawRectangle(screenW * 0.0205, screenH * 0.2604, screenW * 0.2130, screenH * 0.0534, tocolor(0, 0, 0, 173), false) dxDrawLine(screenW * 0.0205, screenH * 0.3138, screenW * 0.2335, screenH * 0.3138, tocolor(255,0,0, 255), 3, false) dxDrawText("Vender Veiculo", screenW * 0.0205, screenH * 0.2604, screenW * 0.2335, screenH * 0.3138, tocolor(255, 255, 255, 255), 1.00, dxfont0_OpenSans_Bold, "center", "center", false, false, false, false, false) -- dxDrawText("Sistema desenvolvido por #00FF00@TioSteiNScripter", screenW * 0.0205, screenH * 0.5820, screenW * 0.2335, screenH * 0.6159, tocolor(255, 255, 255, 255), 1.00, dxfont1_OpenSans_Bold, "center", "center", false, false, false, true, false) dxDrawLine((screenW * 0.0622) - 1, (screenH * 0.4063) - 1, (screenW * 0.0622) - 1, screenH * 0.4701, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(screenW * 0.1977, (screenH * 0.4063) - 1, (screenW * 0.0622) - 1, (screenH * 0.4063) - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawLine((screenW * 0.0622) - 1, screenH * 0.4701, screenW * 0.1977, screenH * 0.4701, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(screenW * 0.1977, screenH * 0.4701, screenW * 0.1977, (screenH * 0.4063) - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawLine((screenW * 0.0622) - 1, (screenH * 0.4922) - 1, (screenW * 0.0622) - 1, screenH * 0.5560, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(screenW * 0.1977, (screenH * 0.4922) - 1, (screenW * 0.0622) - 1, (screenH * 0.4922) - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawLine((screenW * 0.0622) - 1, screenH * 0.5560, screenW * 0.1977, screenH * 0.5560, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(screenW * 0.1977, screenH * 0.5560, screenW * 0.1977, (screenH * 0.4922) - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawEditBox("Digite o RG do jogador", screenW * 0.0278, screenH * 0.3346, screenW * 0.1984, screenH * 0.0534, false, 10, RGEnviar) if isCursorOnElement(screenW * 0.0622, screenH * 0.4063, screenW * 0.1354, screenH * 0.0638) then dxDrawRectangle(screenW * 0.0622, screenH * 0.4063, screenW * 0.1354, screenH * 0.0638, tocolor(255,0,0, 255), false) else dxDrawRectangle(screenW * 0.0622, screenH * 0.4063, screenW * 0.1354, screenH * 0.0638, tocolor(255,0,0, 120), false) end if isCursorOnElement(screenW * 0.0622, screenH * 0.4922, screenW * 0.1354, screenH * 0.0638) then dxDrawRectangle(screenW * 0.0622, screenH * 0.4922, screenW * 0.1354, screenH * 0.0638, tocolor(255,0,0, 255), false) else dxDrawRectangle(screenW * 0.0622, screenH * 0.4922, screenW * 0.1354, screenH * 0.0638, tocolor(255,0,0, 120), false) end dxDrawText("Enviar", screenW * 0.0622, screenH * 0.4036, screenW * 0.1977, screenH * 0.4701, tocolor(255, 255, 255, 255), 1.00, dxfont0_OpenSans_Bold, "center", "center", false, false, false, false, false) dxDrawText("Fechar", screenW * 0.0622, screenH * 0.4896, screenW * 0.1977, screenH * 0.5560, tocolor(255, 255, 255, 255), 1.00, dxfont0_OpenSans_Bold, "center", "center", false, false, false, false, false) end function Painel3 () exports["Blur"]:dxDrawBluredRectangle(screenW * 0.0187, screenH * 0.2156, screenW * 0.2162, screenH * 0.4433, tocolor(255, 255, 255, 230)) dxDrawRectangle(screenW * 0.0187, screenH * 0.2156, screenW * 0.2162, screenH * 0.4433, tocolor(0, 0, 0, 114), false) dxDrawRectangle(screenW * 0.0187, screenH * 0.2156, screenW * 0.2162, screenH * 0.0578, tocolor(0, 0, 0, 175), false) dxDrawLine(screenW * 0.0187, screenH * 0.2733, screenW * 0.2350, screenH * 0.2733, tocolor(255,0,0, 255), 3, false) dxDrawText("Gerenciamento de Veiculos", screenW * 0.0187, screenH * 0.2156, screenW * 0.2350, screenH * 0.2733, tocolor(255, 255, 255, 255), 1.00, dxfont0_icons, "center", "center", false, false, false, false, false) if isCursorOnElement(screenW * 0.0238, screenH * 0.5056, screenW * 0.1000, screenH * 0.0544) then dxDrawImage(screenW * 0.0238, screenH * 0.5056, screenW * 0.1000, screenH * 0.0544, "botao.png", 0, 0, 0, tocolor(255,0,0, 255), false) else dxDrawImage(screenW * 0.0238, screenH * 0.5056, screenW * 0.1000, screenH * 0.0544, "botao.png", 0, 0, 0, tocolor(255,0,0, 120), false) end if isCursorOnElement(screenW * 0.1288, screenH * 0.5056, screenW * 0.1000, screenH * 0.0544) then dxDrawImage(screenW * 0.1288, screenH * 0.5056, screenW * 0.1000, screenH * 0.0544, "botao.png", 0, 0, 0, tocolor(255,0,0, 255), false) else dxDrawImage(screenW * 0.1288, screenH * 0.5056, screenW * 0.1000, screenH * 0.0544, "botao.png", 0, 0, 0, tocolor(255,0,0, 120), false) end if isCursorOnElement(screenW * 0.0238, screenH * 0.5711, screenW * 0.2050, screenH * 0.0544) then dxDrawImage(screenW * 0.0238, screenH * 0.5711, screenW * 0.2050, screenH * 0.0544, "botao.png", 0, 0, 0, tocolor(255,0,0, 255), false) else dxDrawImage(screenW * 0.0238, screenH * 0.5711, screenW * 0.2050, screenH * 0.0544, "botao.png", 0, 0, 0, tocolor(255,0,0, 120), false) end dxDrawText("Enviar p/ Player", screenW * 0.0238, screenH * 0.5022, screenW * 0.1237, screenH * 0.5600, tocolor(255, 255, 255, 255), 1.00, dxfont0_icons, "center", "center", false, false, false, false, false) dxDrawText("Vender p/ Conce", screenW * 0.1288, screenH * 0.5022, screenW * 0.2288, screenH * 0.5600, tocolor(255, 255, 255, 255), 1.00, dxfont0_icons, "center", "center", false, false, false, false, false) dxDrawText("Localizar Veiculo", screenW * 0.0238, screenH * 0.5711, screenW * 0.2288, screenH * 0.6256, tocolor(255, 255, 255, 255), 1.00, dxfont0_icons, "center", "center", false, false, false, false, false) end addEventHandler("onClientKey", root, function (button, press) local Perm = getElementData(getLocalPlayer(),"TS:Painel") or nil if Perm ~= nil then if button == "F1" or button == "F2" or button == "F3" or button == "F4" or button == "F5" or button == "F6" or button == "F7" or button == "b" or button == "F9" or button == "F10" or button == "F11" or button == "F12" or button == "a" or button == "shift" or button == "cntrl" or button == "alt" then cancelEvent() end end end ) addEventHandler("onClientResourceStart", resourceRoot, function () ListaLojaCarros = dxGridW:Create(352, 247, 367, 218) ListaLojaCarros:AddColumn("Veiculo", 100) ListaLojaCarros:AddColumn("Valor", 130) ListaLojaCarros:AddColumn("ID", 30) ListaLojaCarros:AddColumn("Slot", 500) ListaLojaCarros:AddColumn("Status", 100) ListaLojaCarros:SetVisible(false) ListaLojaCarros2 = dxGridW:Create(36, 250, 334, 200) ListaLojaCarros2:AddColumn("Veiculo", 100) ListaLojaCarros2:AddColumn("Valor", 100) ListaLojaCarros2:AddColumn("ID", 30) ListaLojaCarros2:AddColumn("Slot", 500) ListaLojaCarros2:AddColumn("Status", 75) ListaLojaCarros2:SetVisible(false) Lista_VeiculosLoja = dxGridW:Create(1240, 240, 340, 290) Lista_VeiculosLoja:AddColumn("Veiculo", 130) Lista_VeiculosLoja:AddColumn("Valor", 100) Lista_VeiculosLoja:AddColumn("Aluguel", 120) Lista_VeiculosLoja:AddColumn("ID", 30) Lista_VeiculosLoja:SetVisible(false) for i, Veiculos in ipairs (VeiculosAVenda) do Lista_VeiculosLoja:AddItem(1, Veiculos[2].."") Lista_VeiculosLoja:AddItem(2, ""..Veiculos[3].."") Lista_VeiculosLoja:AddItem(3, ""..Veiculos[4].."") Lista_VeiculosLoja:AddItem(4, ""..Veiculos[1].."") end end) function Reload_LojaCarros () ListaLojaCarros:Clear(true) ListaLojaCarros2:Clear(true) local data = getElementData(localPlayer, "TS:VeiculosInfo") for i, data in ipairs (data) do local Valor = data['Valor'] local IDVeiculo = data['IDVeiculo'] local NomeVeiculo = data['NomeVeiculo'] local Status = data['Status'] local Emplacamento = data['ID'] ListaLojaCarros:AddItem(1, NomeVeiculo.."") ListaLojaCarros:AddItem(2, ""..Valor.."") ListaLojaCarros:AddItem(3, ""..IDVeiculo.."") ListaLojaCarros:AddItem(4, ""..Emplacamento) ListaLojaCarros:AddItem(5, Status.."") ListaLojaCarros2:AddItem(1, NomeVeiculo.."") ListaLojaCarros2:AddItem(2, ""..Valor.."") ListaLojaCarros2:AddItem(3, ""..IDVeiculo.."") ListaLojaCarros2:AddItem(4, ""..Emplacamento) ListaLojaCarros2:AddItem(5, Status.."") end end paineldocumentos = false --[[ ><><><><><><><><><><><><><><><><><><><>< ><Configurações N Altere>< ><><><><><><><><><><><><><><><><><><><>< --]] function AbrirPresentear () if painelpresentear == false then addEventHandler ( "onClientRender", root, PainelEnviar ) painelpresentear = true showCursor ( true ) playSoundFrontEnd ( 43 ) setElementData(RGEnviar, "text2", "") setElementData(RGEnviar, "state", true) else removeEventHandler ( "onClientRender", root, PainelEnviar ) painelpresentear = false showCursor ( false ) playSoundFrontEnd ( 43 ) end end function AbrirDoc () if paineldocumentos == false then addEventHandler ( "onClientRender", root, DocumentoVeiculo ) paineldocumentos = true showCursor ( true ) playSoundFrontEnd ( 43 ) else removeEventHandler ( "onClientRender", root, DocumentoVeiculo ) paineldocumentos = false showCursor ( false ) playSoundFrontEnd ( 43 ) end end addEvent ("TS:AbrirDoc", true) addEventHandler ("TS:AbrirDoc", root, AbrirDoc) function convertTime(ms) local min = math.floor ( ms/60000 ) local sec = math.floor( (ms/1000)%60 ) return min, sec end function AbrirComprarCarro () if not painel then addEventHandler ("onClientRender", root, PainelLojaCarros) painel = true showCursor (painel) playSoundFrontEnd (43) Lista_VeiculosLoja:SetVisible(true) end end addEvent ("TS:AbrirComprarCarro", true) addEventHandler ("TS:AbrirComprarCarro", root, AbrirComprarCarro) function AbrirLojaCarros2 () tick = getTickCount() if painel2 == false then addEventHandler ( "onClientRender", root, PainelLojaCarros2 ) painel2 = true showCursor ( true ) playSoundFrontEnd ( 43 ) ListaLojaCarros:SetVisible(true) Reload_LojaCarros() showChat(false) else FecharLojaCarros2() end end addEvent ("TS:AbrirLojaCarros2", true) addEventHandler ("TS:AbrirLojaCarros2", root, AbrirLojaCarros2) function AbrirLojaCarros3 () if painel2 == false then addEventHandler ( "onClientRender", root, Painel3 ) painel2 = true showCursor ( true ) playSoundFrontEnd ( 43 ) ListaLojaCarros2:SetVisible(true) Reload_LojaCarros() showChat(false) else removeEventHandler("onClientRender", root, Painel3 ) showChat(true) showCursor (false) playSoundFrontEnd ( 43 ) painel2 = false ListaLojaCarros2:SetVisible(false) end end bindKey("F5", "down", AbrirLojaCarros3) function ClicandoF5(_, state) if painel2 == true then local gridItem = ListaLojaCarros2:GetSelectedItem() if gridItem then if isCursorOnElement(screenW * 0.0238, screenH * 0.5056, screenW * 0.1000, screenH * 0.0544) then -------- Presentear local NomeDoCarro = ListaLojaCarros2:GetItemDetails(1, gridItem, 1) local IDDoCarro = ListaLojaCarros2:GetItemDetails(3, gridItem, 3) local ValorDoCarro = ListaLojaCarros2:GetItemDetails(2, gridItem, 2) local SlotCarro = ListaLojaCarros2:GetItemDetails(4, gridItem, 4) setElementData(localPlayer, "TS:NomeCarroAVenda", NomeDoCarro) setElementData(localPlayer, "TS:IDCarroAVenda", IDDoCarro) setElementData(localPlayer, "TS:SlotCarroAVenda", SlotCarro) setElementData(localPlayer, "TS:ValorCarroAVenda", ValorDoCarro) playSoundFrontEnd ( 43 ) AbrirPresentear() removeEventHandler("onClientRender", root, Painel3 ) showCursor (false) playSoundFrontEnd ( 43 ) painel2 = false ListaLojaCarros2:SetVisible(false) showChat(true) elseif isCursorOnElement(screenW * 0.1288, screenH * 0.5056, screenW * 0.1000, screenH * 0.0544) then ---- Vender Conce local NomeDoCarro = ListaLojaCarros2:GetItemDetails(1, gridItem, 1) local IDDoCarro = ListaLojaCarros2:GetItemDetails(3, gridItem, 3) playSoundFrontEnd ( 43 ) triggerServerEvent( 'TS:VenderVeiculoConce', getLocalPlayer(), localPlayer, IDDoCarro, NomeDoCarro) removeEventHandler("onClientRender", root, Painel3 ) showCursor (false) playSoundFrontEnd ( 43 ) painel2 = false ListaLojaCarros2:SetVisible(false) showChat(true) elseif isCursorOnElement(screenW * 0.0238, screenH * 0.5711, screenW * 0.2050, screenH * 0.0544) then ---- Localizar local NomeDoCarro = ListaLojaCarros2:GetItemDetails(1, gridItem, 1) local ValorCarro = ListaLojaCarros2:GetItemDetails(2, gridItem, 2) local IDDoCarro = ListaLojaCarros2:GetItemDetails(3, gridItem, 3) local SlotCarro = ListaLojaCarros2:GetItemDetails(4, gridItem, 4) playSoundFrontEnd ( 43 ) triggerServerEvent( 'TS:LocalizarVeiculo', getLocalPlayer(), localPlayer, NomeDoCarro, IDDoCarro, SlotCarro,ValorCarro) removeEventHandler("onClientRender", root, Painel3 ) showCursor (false) playSoundFrontEnd ( 43 ) painel2 = false ListaLojaCarros2:SetVisible(false) showChat(true) end end end end addEventHandler ("onClientClick", root, ClicandoF5 ) function FecharLojaCarros (_,state) if painel == true then if isCursorOnElement ( screenW * 0.7788, screenH * 0.8467, screenW * 0.2013, screenH * 0.0522 ) then if isElement(Veiculo[localPlayer]) then destroyElement(Veiculo[localPlayer]) end removeEventHandler("onClientRender", root, PainelLojaCarros ) showCursor (false) playSoundFrontEnd ( 43 ) setElementPosition(localPlayer, 1797.9475097656,-1777.2038574219,13.701637268066) painel = false Lista_VeiculosLoja:SetVisible(false) setCameraTarget(localPlayer) end end end addEventHandler ("onClientClick", root, FecharLojaCarros ) function FecharEnviar (_,state) if painelpresentear == true then if isCursorOnElement ( screenW * 0.0622, screenH * 0.4922, screenW * 0.1354, screenH * 0.0638 ) then removeEventHandler("onClientRender", root, PainelEnviar ) showCursor (false) playSoundFrontEnd ( 43 ) painelpresentear = false end end end addEventHandler ("onClientClick", root, FecharEnviar ) function FecharLojaCarros2 (_,state) if painel2 == true then if isCursorOnElement ( screenW * 0.2219, screenH * 0.6500, screenW * 0.2213, screenH * 0.0522 ) then removeEventHandler("onClientRender", root, PainelLojaCarros2 ) showChat(true) showCursor (false) playSoundFrontEnd ( 43 ) painel2 = false ListaLojaCarros:SetVisible(false) end end end addEventHandler ("onClientClick", root, FecharLojaCarros2 ) function TrocarCor ( _,state ) if painel == true then if state == "down" then if isCursorOnElement(screenW * 0.7875, screenH * 0.6000, screenW * 0.0294, screenH * 0.0456) then if isElement(Veiculo[localPlayer]) then setVehicleColor(Veiculo[localPlayer], 255, 255, 255, 255, 255, 255) end elseif isCursorOnElement(screenW * 0.8256, screenH * 0.6000, screenW * 0.0294, screenH * 0.0456) then if isElement(Veiculo[localPlayer]) then setVehicleColor(Veiculo[localPlayer], 0, 0, 0, 0, 0, 0) end elseif isCursorOnElement(screenW * 0.8638, screenH * 0.6000, screenW * 0.0294, screenH * 0.0456) then if isElement(Veiculo[localPlayer]) then setVehicleColor(Veiculo[localPlayer], 0, 28, 241, 0, 28, 241) end elseif isCursorOnElement(screenW * 0.9019, screenH * 0.6000, screenW * 0.0294, screenH * 0.0456) then if isElement(Veiculo[localPlayer]) then setVehicleColor(Veiculo[localPlayer], 34, 240, 0, 34, 240, 0) end elseif isCursorOnElement(screenW * 0.9400, screenH * 0.6000, screenW * 0.0294, screenH * 0.0456) then if isElement(Veiculo[localPlayer]) then setVehicleColor(Veiculo[localPlayer], 239, 0, 5, 239, 0, 5) end end end end end addEventHandler ( "onClientClick", root, TrocarCor ) Timer = {} function OlharVeiculo ( _,state ) if painel == true then if state == "down" then if isCursorOnElement(screenW * 0.7788, screenH * 0.6567, screenW * 0.2013, screenH * 0.0522) then if isElement(Veiculo[localPlayer]) then destroyElement(Veiculo[localPlayer]) end local gridItem = Lista_VeiculosLoja:GetSelectedItem() if gridItem then local IDDoCarro = Lista_VeiculosLoja:GetItemDetails(4, gridItem, 4) if isElement(Timer[localPlayer]) then killTimer(Timer[localPlayer]) end Veiculo[localPlayer] = createVehicle(IDDoCarro, 1713.89392, -1138.08679, 24.07813) setCameraMatrix(1715.93567, -1126.55969, 27.51149,0,-8120,-2110) setVehicleColor(Veiculo[localPlayer], 255, 255, 255) setVehiclePlateText(Veiculo[localPlayer], "Loja") Loop(localPlayer) end end end end end addEventHandler ( "onClientClick", root, OlharVeiculo ) function Loop(source) Timer[source] = setTimer(function() if not isElement(Veiculo[source]) then return end local Rot1, Rot2, Rot3 = getElementRotation(Veiculo[source]) setElementRotation(Veiculo[source], Rot1 , Rot2, Rot3+1) end ,22, 0) end function Alugar ( _,state ) if painel == true then if state == "down" then if isCursorOnElement(screenW * 0.7788, screenH * 0.7833, screenW * 0.2013, screenH * 0.0522) then local gridItem = Lista_VeiculosLoja:GetSelectedItem() if gridItem then local NomeVeiculo = Lista_VeiculosLoja:GetItemDetails(1, gridItem, 1) local ValorVeiculo = Lista_VeiculosLoja:GetItemDetails(2, gridItem, 2) local AluguelVeiculo = Lista_VeiculosLoja:GetItemDetails(3, gridItem, 3) local IDDoCarro = Lista_VeiculosLoja:GetItemDetails(4, gridItem, 4) if isElement(Veiculo[localPlayer]) then local r1, g1, b1, r2, g2, b2 = getVehicleColor(Veiculo[localPlayer], true) or 255, 255, 255, 255, 255, 255 end if isElement(Veiculo[localPlayer]) then destroyElement(Veiculo[localPlayer]) end removeEventHandler("onClientRender", root, PainelLojaCarros ) showCursor (false) playSoundFrontEnd ( 43 ) painel = false Lista_VeiculosLoja:SetVisible(false) setCameraTarget(localPlayer) triggerServerEvent("TS:AlugarVeiculo", getLocalPlayer(), localPlayer, NomeVeiculo, ValorVeiculo, AluguelVeiculo, IDDoCarro, r1, g1, b1, r2, g2, b2) end end end end end addEventHandler ( "onClientClick", root, Alugar ) function Comprar ( _,state ) if painel == true then if state == "down" then if isCursorOnElement(screenW * 0.7788, screenH * 0.7200, screenW * 0.2013, screenH * 0.0522) then local gridItem = Lista_VeiculosLoja:GetSelectedItem() if gridItem then local NomeVeiculo = Lista_VeiculosLoja:GetItemDetails(1, gridItem, 1) local ValorVeiculo = Lista_VeiculosLoja:GetItemDetails(2, gridItem, 2) local AluguelVeiculo = Lista_VeiculosLoja:GetItemDetails(3, gridItem, 3) local IDDoCarro = Lista_VeiculosLoja:GetItemDetails(4, gridItem, 4) if isElement(Veiculo[localPlayer]) then local r1, g1, b1, r2, g2, b2 = getVehicleColor(Veiculo[localPlayer], true) or 255, 255, 255, 255, 255, 255 end if isElement(Veiculo[localPlayer]) then destroyElement(Veiculo[localPlayer]) end removeEventHandler("onClientRender", root, PainelLojaCarros ) showCursor (false) playSoundFrontEnd ( 43 ) painel = false Lista_VeiculosLoja:SetVisible(false) setCameraTarget(localPlayer) triggerServerEvent("TS:ComprarVeiculo", getLocalPlayer(), localPlayer, NomeVeiculo, ValorVeiculo, AluguelVeiculo, IDDoCarro, r1, g1, b1, r2, g2, b2) end end end end end addEventHandler ( "onClientClick", root, Comprar ) function ClicandoGaragem (_,state) if painel2 == true then if state == "down" then if not ListaLojaCarros:GetSelectedItem() then return end if isCursorOnElement ( screenW * 0.2219, screenH * 0.5233, screenW * 0.2213, screenH * 0.0522 ) then -------- Pegar Veiculo local gridItem = ListaLojaCarros:GetSelectedItem() local NomeDoCarro = ListaLojaCarros:GetItemDetails(1, gridItem, 1) local ValorCarro = ListaLojaCarros:GetItemDetails(2, gridItem, 2) local IDDoCarro = ListaLojaCarros:GetItemDetails(3, gridItem, 3) local SlotCarro = ListaLojaCarros:GetItemDetails(4, gridItem, 4) playSoundFrontEnd ( 43 ) triggerServerEvent( 'TS:PegarVeiculo', getLocalPlayer(), localPlayer, NomeDoCarro, IDDoCarro, SlotCarro,ValorCarro) removeEventHandler("onClientRender", root, PainelLojaCarros2 ) showCursor (false) playSoundFrontEnd ( 43 ) painel2 = false ListaLojaCarros:SetVisible(false) showChat(true) elseif isCursorOnElement(screenW * 0.2219, screenH * 0.5867, screenW * 0.2213, screenH * 0.0522) then -------- Guardar Veiculo local gridItem = ListaLojaCarros:GetSelectedItem() local NomeDoCarro = ListaLojaCarros:GetItemDetails(1, gridItem, 1) local IDDoCarro = ListaLojaCarros:GetItemDetails(3, gridItem, 3) local SlotCarro = ListaLojaCarros:GetItemDetails(4, gridItem, 4) playSoundFrontEnd ( 43 ) triggerServerEvent( 'TS:GuardarVeiculo', getLocalPlayer(), localPlayer, NomeDoCarro, IDDoCarro, SlotCarro) removeEventHandler("onClientRender", root, PainelLojaCarros2 ) showCursor (false) playSoundFrontEnd ( 43 ) painel2 = false ListaLojaCarros:SetVisible(false) showChat(true) end end end end addEventHandler ("onClientClick", root, ClicandoGaragem ) function EnviarCarro (_, state) if painelpresentear == true then if state == "down" then if isCursorOnElement ( screenW * 0.0622, screenH * 0.4063, screenW * 0.1354, screenH * 0.0638 ) then local getID = tonumber(getElementData(RGEnviar, "text2")) local IDCar = getElementData(localPlayer, "TS:IDCarroAVenda") or 0 local NameCar = getElementData(localPlayer, "TS:NomeCarroAVenda") or nil if type(getID) == "number" then AbrirPresentear () triggerServerEvent( 'TS:EnviarVeiculo', getLocalPlayer(), localPlayer, getID, IDCar, NameCar) end end end end end addEventHandler ("onClientClick", root, EnviarCarro ) function isCursorOnElement ( x, y, w, h ) 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 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 getVehicleModelFromNewName (name) for i,v in pairs ( customCarNames ) do if v == name then return i end end return false end painelroubo = false function PainelTranca () local barra = interpolateBetween(0, 0, 0, 0.2613, 0, 0, (getTickCount()-tick)/1/60000, "Linear") exports["Blur"]:dxDrawBluredRectangle(screenW * 0.3214, screenH * 0.4661, screenW * 0.3572, screenH * 0.0677, tocolor(255, 255, 255, 230)) dxDrawLine((screenW * 0.3214) - 1, (screenH * 0.4661) - 1, (screenW * 0.3214) - 1, screenH * 0.5339, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(screenW * 0.6786, (screenH * 0.4661) - 1, (screenW * 0.3214) - 1, (screenH * 0.4661) - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawLine((screenW * 0.3214) - 1, screenH * 0.5339, screenW * 0.6786, screenH * 0.5339, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(screenW * 0.6786, screenH * 0.5339, screenW * 0.6786, (screenH * 0.4661) - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawRectangle(screenW * 0.3214, screenH * 0.4661, screenW * 0.3572, screenH * 0.0677, tocolor(0, 0, 0, 147), false) dxDrawRectangle(screenW * 0.3214, screenH * 0.4661, screenW * barra, screenH * 0.0677, tocolor(0, 85, 227, 170), false) dxDrawText("Roubando veiculo....", screenW * 0.3214, screenH * 0.4661, screenW * 0.6786, screenH * 0.5339, tocolor(255, 255, 255, 255), 1.00, dxfont0_icons, "center", "center", false, false, false, false, false) end function AbrirRouboVeiculo () tick = getTickCount() if painelroubo == false then addEventHandler ( "onClientRender", root, PainelTranca ) painelroubo = true showCursor ( true ) playSoundFrontEnd ( 43 ) else removeEventHandler ( "onClientRender", root, PainelTranca ) painelroubo = false showCursor ( false ) playSoundFrontEnd ( 43 ) end end addEvent ("TS:AbrirRouboVeiculo", true) addEventHandler ("TS:AbrirRouboVeiculo", root, AbrirRouboVeiculo) function BloquearTecla(key) if painelroubo == true and (key:upper() == "lshift") then cancelEvent() end end addEventHandler("onClientKey", root, BloquearTecla) function BloquearTecla2(key) if painelroubo == true and (key:upper() == "rshift") then cancelEvent() end end addEventHandler("onClientKey", root, BloquearTecla2) local drawDistance = 15 g_StreamedInPlayers = {} function onClientRender() local cx, cy, cz, lx, ly, lz = getCameraMatrix() for k, player in pairs(g_StreamedInPlayers) do if isElement(player) and isElementStreamedIn(player) then do local Placa = getElementData(localPlayer, "TS:Placa") or "Ativa" if Placa ~= "Ativa" then return end local vx, vy, vz = getElementPosition(player, 4) local dist = getDistanceBetweenPoints3D(cx, cy, cz, vx, vy, vz) if dist < drawDistance and isLineOfSightClear(cx, cy, cz, vx, vy, vz, true, false, false) then local x, y = getScreenFromWorldPosition(vx, vy, vz) if x and y then local ID = getVehiclePlateText(player) local w = dxGetTextWidth(ID, 0.1, "default-bold") local h = dxGetFontHeight(1, "default-bold") if getElementData(player, "TS:Roubado") == true then dxDrawText(ID, x , y, w, h, tocolor(255, 0, 0), 1.20, "default-bold", "left", "top", false, false, false, false, false) else dxDrawText(ID, x , y, w, h, tocolor(255, 255, 255), 1.20, "default-bold", "left", "top", false, false, false, false, false) end CorTag = tocolor(255, 255, 255) end end end else table.remove(g_StreamedInPlayers, k) end end end addEventHandler("onClientRender", root, onClientRender) function onClientElementStreamIn() if getElementType(source) == "vehicle" and source ~= getLocalPlayer() then setPlayerNametagShowing(source, false) table.insert(g_StreamedInPlayers, source) end end addEventHandler("onClientElementStreamIn", root, onClientElementStreamIn) function onClientResourceStart(startedResource) visibleTick = getTickCount() counter = 0 local players = getElementsByType("vehicle") for k, v in pairs(players) do if isElementStreamedIn(v) then setPlayerNametagShowing(v, false) table.insert(g_StreamedInPlayers, v) end end end addEventHandler("onClientResourceStart", resourceRoot, onClientResourceStart) 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