Jump to content

gabezin_pz

Members
  • Posts

    3
  • Joined

  • Last visited

Everything posted by gabezin_pz

  1. --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --- RESOLUÇÃO --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- local screenW, screenH = guiGetScreenSize() local resW, resH = 1360,768 local x, y = (screenW/resW), (screenH/resH) local font = dxCreateFont("files/fontt3.ttf", 9) local font2 = dxCreateFont("files/fontt2.ttf", 7.9) local font3 = dxCreateFont("files/fontt4.ttf", 7) local font4 = dxCreateFont("files/fontt2.ttf", 8) local font5 = dxCreateFont("files/fontt4.ttf", 18) local font_1 = dxCreateFont("files/fontt3.ttf", 9) local font_2 = dxCreateFont("files/fontt3.ttf", 7) local font_5 = dxCreateFont("files/fontt4.ttf", 9) local font_6 = dxCreateFont("files/fontt4.ttf", 8) local font_1 = dxCreateFont("files/fontt2.ttf", 7.9) local font_2 = dxCreateFont("files/fontt4.ttf", 7) local font_3 = dxCreateFont("files/fontt2.ttf", 8) local font_4 = dxCreateFont("files/fontt4.ttf", 9) local font_5 = dxCreateFont("files/fontt4.ttf", 8) local visiblebau = false local objbau = nil local bauid = nil local bautag = nil local baupos = nil local baudist = nil --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --- DX --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- function acdxbaus() if visiblebau == true then dxDrawACRectangle("#2a692fH#ffffff ABRIR", baupos[1], baupos[2], baupos[3] + 0.3, 0.8, tocolor(255, 255, 255, 130), tocolor(30, 30, 30, 100), 1.0, font_5) end end --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --- DX BAU --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- selected = nil selected2 = nil qntd = {} table.insert(qntd, "QTD") function dxmenub1() local Inv1 = convert(getElementData(localPlayer, "Inventário:Slots")) or "0" local Inv2 = convert(getElementData(localPlayer, "Inventário:Max")) or "0" local Inv3 = convert(getElementData(objbau, "Bau:Slots")) or 0 local Inv4 = convert(getElementData(objbau, "Bau:Max")) or 0 local QTD = table.concat(qntd) dxDrawRectangle(x*0, y*0, x*3000, y*3000, tocolor(0, 0, 0, 120)) dxDrawText("PESO: "..Inv1.." / "..Inv2.."", x*610+1, y*15+1, x*610+1, y*200+1, tocolor(0, 0, 0), 1.0, font_3, "right", "center", false, false, true, true, false) dxDrawText("#525252PESO#ffffff: #bebebe"..Inv1.."#ffffff / #bebebe"..Inv2.."", x*610, y*15, x*610, y*200, tocolor(255, 255, 255), 1.0, font_3, "right", "center", false, false, true, true, false) roundedRectangle2(x*100, y*120, x*519, y*3, tocolor(45, 45, 45)) if Inv1 >= 1 then roundedRectangle2(x*100, y*120, x*519/Inv2*Inv1, y*3, tocolor(30, 30, 30)) end --- dxDrawText("PESO: "..Inv3.." / "..Inv4.."", x*1275+1, y*15+1, x*1275+1, y*200+1, tocolor(0, 0, 0), 1.0, font_3, "right", "center", false, false, true, true, false) dxDrawText("#525252PESO#ffffff: #bebebe"..Inv3.."#ffffff / #bebebe"..Inv4.."", x*1275, y*15, x*1275, y*200, tocolor(255, 255, 255), 1.0, font_3, "right", "center", false, false, true, true, false) roundedRectangle2(x*770, y*120, x*519, y*3, tocolor(45, 45, 45)) if Inv3 >= 1 then roundedRectangle2(x*770, y*120, x*519/Inv4*Inv3, y*3, tocolor(30, 30, 30)) end --- < QTD > --- roundedRectangle2(x*650, y*150, x*90, y*35, tocolor(255, 255, 255, 10), tocolor(33, 33, 33, 120)) dxDrawText(convertNumber(QTD), x*695, y*140, x*695, y*200, tocolor(255, 255, 255, 150), 1.0, font_3, "center", "center", false, false, true, true, false) items2 = exports.acrp:ACGetItens() local column2, row2 = y*0, y*0 local limitColumn2 = 4 local itemsToDisplay2 = #items2 local distanceBetweenBoxes2 = 5 local distanceBetweenBoxes22 = 5 local distanceBetweenBoxes33 = 5 local itemWidth2 = x*100 local itemHeight2 = y*120 for i2 = 1, itemsToDisplay2 do itemHere2 = items2[i2] if itemHere2 then if getElementData(localPlayer, itemHere2[2]) >= 1 then local x22 = column2 * (itemWidth2 + distanceBetweenBoxes2) local y22 = y*row2 * (itemHeight2 + distanceBetweenBoxes2) local x33 = column2 * (itemWidth2 + distanceBetweenBoxes22) local y33 = row2 * (itemHeight2 + distanceBetweenBoxes33) if (selected2 == i2) then local cX, cY = getCursorPosition() cX, cY = screenW * cX, screenH * cY roundedRectangle3(cX - x*30, cY - y*35, itemWidth2, itemHeight2, tocolor(30, 30, 30), tocolor(33, 33, 33)) roundedRectangle3(cX - x*29, cY + y*65, itemWidth2 - 2, y*15, tocolor(30, 30, 30)) dxDrawImage(cX - x*30, cY - y*30, x*100, y*100, "files/itens/"..itemHere2[4]..".png", 0, 0, 0, tocolor(255, 255, 255), true) dxDrawText(itemHere2[1], cX + x*130, cY + y*70, cX - x*83, y3, tocolor(255, 255, 255, 130), 1.0, font3, "center", "top", false, false, true, true, false) dxDrawText(itemHere2[3]*getElementData(localPlayer, itemHere2[2]), cX - x*20, cY - y*30, cX - x*83, y33, tocolor(255, 255, 255, 130), 1.0, font2, "left", "top", false, false, true, true, false) dxDrawText(convertNumber(getElementData(localPlayer, itemHere2[2])).."x", cX + x*60, cY - y*30, cX + x*65, y33, tocolor(255, 255, 255, 130), 1.0, font2, "right", "top", false, false, true, true, false) else roundedRectangle(x22 + x*100, y33 + y*130, itemWidth2, itemHeight2, tocolor(33, 33, 33, 120)) roundedRectangle(x22 + x*100, y33 + y*230, itemWidth2, y*19, tocolor(30, 30, 30)) dxDrawImage(x22 + x*100, y33 + y*133, x*100, y*100, "files/itens/"..itemHere2[4]..".png", 0, 0, 0, tocolor(255, 255, 255), true) dxDrawText(itemHere2[1], x33 + x*150, y33 + y*478, x33 + x*150, y33, tocolor(255, 255, 255, 130), 1.0, font3, "center", "center", false, false, true, true, false) dxDrawText(itemHere2[3]*getElementData(localPlayer, itemHere2[2]), x33 + x*105, y33 + y*280, x33 + x*105, y33, tocolor(255, 255, 255, 130), 1.0, font2, "left", "center", false, false, true, true, false) dxDrawText(convertNumber(getElementData(localPlayer, itemHere2[2])).."x", x33 + x*195, y33 + y*280, x33 + x*195, y33, tocolor(255, 255, 255, 130), 1.0, font2, "right", "center", false, false, true, true, false) --- < INFO ITENS > --- if isCursorOnElement(x22 + x*100, y33 + y*130, itemWidth2, itemHeight2) then roundedRectangle(x*615, y*670, x*180+2, y*85+2, tocolor(23, 23, 23)) roundedRectangle(x*615, y*670, x*180, y*85, tocolor(33, 33, 33)) dxDrawRectangle(x*625, y*700, x*160, y*1, tocolor(255, 255, 255, 70), true) dxDrawText(itemHere2[1], x*705+1, y*1332+1, x*705+1, y*40+1, tocolor(0, 0, 0, 150), 1.0, font_5, "center", "center", false, false, true, true, false) dxDrawText(itemHere2[1], x*705, y*1332, x*705, y*40, tocolor(255, 255, 255, 200), 1.0, font_5, "center", "center", false, false, true, true, false) if itemHere2[5] == 0 then dxDrawText("Tipo: "..itemHere2[6].." | Máx: S/L", x*630+1, y*1400+1, x*630+1, y*40+1, tocolor(0, 0, 0, 130), 1.0, font_6, "left", "center", false, false, true, true, false) dxDrawText("#294f91Tipo: #bebebe"..itemHere2[6].." | #294f91Máx: #bebebeS/L", x*630, y*1400, x*630, y*40, tocolor(255, 255, 255, 200), 1.0, font_6, "left", "center", false, false, true, true, false) else dxDrawText("Tipo: "..itemHere2[6].." | Máx: "..itemHere2[5], x*630+1, y*1400+1, x*630+1, y*40+1, tocolor(0, 0, 0, 130), 1.0, font_6, "left", "center", false, false, true, true, false) dxDrawText("#294f91Tipo: #bebebe"..itemHere2[6].." | #294f91Máx: #bebebe"..itemHere2[5], x*630, y*1400, x*630, y*40, tocolor(255, 255, 255, 200), 1.0, font_6, "left", "center", false, false, true, true, false) end dxDrawText("Peso: "..itemHere2[3], x*630+1, y*1435+1, x*630+1, y*40+1, tocolor(0, 0, 0, 130), 1.0, font_6, "left", "center", false, false, true, true, false) dxDrawText("#294f91Peso: #bebebe"..itemHere2[3], x*630, y*1435, x*630, y*40, tocolor(255, 255, 255, 200), 1.0, font_6, "left", "center", false, false, true, true, false) end end column2 = column2 + 1 if (column2 > limitColumn2) then column2 = 0 row2 = row2 + 1 end end end end --- < ITENS - 2 > --- items = exports.acrp:ACGetItens() local column, row = y*0, y*0 local limitColumn = 4 local itemsToDisplay = #items local distanceBetweenBoxes = 5 local distanceBetweenBoxes2 = 5 local distanceBetweenBoxes3 = 5 local itemWidth = x*100 local itemHeight = y*120 for i = 1, itemsToDisplay do itemHere = items[i] if itemHere then if getElementData(objbau, itemHere[2]) >= 1 then local x2 = column * (itemWidth + distanceBetweenBoxes) local y2 = y*row * (itemHeight + distanceBetweenBoxes) local x3 = column * (itemWidth + distanceBetweenBoxes2) local y3 = row * (itemHeight + distanceBetweenBoxes3) if (selected == i) then local cX, cY = getCursorPosition() cX, cY = screenW * cX, screenH * cY roundedRectangle3(cX - x*30, cY - y*35, itemWidth, itemHeight, tocolor(30, 30, 30), tocolor(33, 33, 33)) roundedRectangle3(cX - x*29, cY + y*65, itemWidth - 2, y*15, tocolor(30, 30, 30)) dxDrawImage(cX - x*30, cY - y*30, x*100, y*100, "files/itens/"..itemHere[4]..".png", 0, 0, 0, tocolor(255, 255, 255), true) dxDrawText(itemHere[1], cX + x*130, cY + y*70, cX - x*83, y3, tocolor(255, 255, 255, 130), 1.0, font_2, "center", "top", false, false, true, true, false) dxDrawText(itemHere[3]*getElementData(objbau, itemHere[2]), cX - x*20, cY - y*30, cX - x*83, y3, tocolor(255, 255, 255, 130), 1.0, font_1, "left", "top", false, false, true, true, false) dxDrawText(convertNumber(getElementData(objbau, itemHere[2])).."x", cX + x*60, cY - y*30, cX + x*65, y3, tocolor(255, 255, 255, 130), 1.0, font_1, "right", "top", false, false, true, true, false) else roundedRectangle(x2 + x*770, y3 + y*130, itemWidth, itemHeight, tocolor(33, 33, 33, 120)) roundedRectangle(x2 + x*770, y3 + y*230, itemWidth - 2, y*19, tocolor(30, 30, 30)) dxDrawImage(x2 + x*773, y3 + y*143, x*90, y*90, "files/itens/"..itemHere[4]..".png", 0, 0, 0, tocolor(255, 255, 255), true) dxDrawText(itemHere[1], x3 + x*820, y3 + y*478, x3 + x*820, y3, tocolor(255, 255, 255, 130), 1.0, font_2, "center", "center", false, false, true, true, false) dxDrawText(itemHere[3], x3 + x*775, y3 + y*280, x3 + x*775, y3, tocolor(255, 255, 255, 130), 1.0, font_1, "left", "center", false, false, true, true, false) dxDrawText(convertNumber(getElementData(objbau, itemHere[2])).."x", x3 + x*865, y3 + y*280, x3 + x*865, y3, tocolor(255, 255, 255, 130), 1.0, font_1, "right", "center", false, false, true, true, false) --- < INFO ITENS > --- if isCursorOnElement(x2 + x*770, y3 + y*130, itemWidth, itemHeight) then roundedRectangle(x*615, y*670, x*180+2, y*85+2, tocolor(23, 23, 23)) roundedRectangle(x*615, y*670, x*180, y*85, tocolor(33, 33, 33)) dxDrawRectangle(x*625, y*700, x*160, y*1, tocolor(255, 255, 255, 70), true) dxDrawText(itemHere[1], x*705+1, y*1332+1, x*705+1, y*40+1, tocolor(0, 0, 0, 150), 1.0, font_5, "center", "center", false, false, true, true, false) dxDrawText(itemHere[1], x*705, y*1332, x*705, y*40, tocolor(255, 255, 255, 200), 1.0, font_5, "center", "center", false, false, true, true, false) if itemHere[5] == 0 then dxDrawText("Tipo: "..itemHere[6].." | Máx: S/L", x*630+1, y*1400+1, x*630+1, y*40+1, tocolor(0, 0, 0, 130), 1.0, font_5, "left", "center", false, false, true, true, false) dxDrawText("#294f91Tipo: #bebebe"..itemHere[6].." | #294f91Máx: #bebebeS/L", x*630, y*1400, x*630, y*40, tocolor(255, 255, 255, 200), 1.0, font_5, "left", "center", false, false, true, true, false) else dxDrawText("Tipo: "..itemHere[6].." | Máx: "..itemHere[5], x*630+1, y*1400+1, x*630+1, y*40+1, tocolor(0, 0, 0, 130), 1.0, font_5, "left", "center", false, false, true, true, false) dxDrawText("#294f91Tipo: #bebebe"..itemHere[6].." | #294f91Máx: #bebebe"..itemHere[5], x*630, y*1400, x*630, y*40, tocolor(255, 255, 255, 200), 1.0, font_5, "left", "center", false, false, true, true, false) end dxDrawText("Peso: "..itemHere2[3], x*630+1, y*1435+1, x*630+1, y*40+1, tocolor(0, 0, 0, 130), 1.0, font_5, "left", "center", false, false, true, true, false) dxDrawText("#294f91Peso: #bebebe"..itemHere2[3], x*630, y*1435, x*630, y*40, tocolor(255, 255, 255, 200), 1.0, font_5, "left", "center", false, false, true, true, false) end end column = column + 1 if (column > limitColumn) then column = 0 row = row + 1 end end end end end --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --- ABRIR --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- function abrirbau() if isEventHandlerAdded("onClientRender", root, acdxbaus) then if visiblebau == true and isElement(getElementData(objbau, "AC-BauCol")) then local Tag = getElementData(objbau, "AC-BauTag") if Tag then if getElementData(localPlayer, "AC-Grupo") == ""..Tag.."" then if getElementData(localPlayer, "AC:ProcuradoT") == false then addEventHandler("onClientRender", root, dxmenub1) removeEventHandler("onClientRender", root, acdxbaus) showCursor(true) else exports.ac_msgbox:ACMsgBox("Você está procurado.", "aviso") end end end end end end bindKey("h", "down", abrirbau) --- function fecharesc() if isEventHandlerAdded("onClientRender", root, dxmenub1) and digqtd == false then removeEventHandler("onClientRender", root, dxmenub1) showCursor(false) qntd = {} table.insert(qntd, "QTD") selected = nil selected2 = nil end end bindKey("backspace", "down", fecharesc) --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --- CLICKS --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- digqtd = false function dxclickss(_, state) if state == "down" then if isEventHandlerAdded("onClientRender", root, dxmenub1) then --- < QTD > -- if isCursorOnElement(x*650, y*150, x*90, y*30) then digqtd = true if table.concat(qntd) == "QTD" then table.remove(qntd, #qntd) end end if not isCursorOnElement(x*650, y*150, x*90, y*30) then digqtd = false end end end end addEventHandler("onClientClick", root, dxclickss) --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --- EVENT SET --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- function onHitdoorcol(hitElement, dim) if hitElement ~= localPlayer then else if dim then if getElementData(source, "AC-BauId") and isElement(getElementData(source, "AC-BauCol")) then if getElementData(localPlayer, "AC-Grupo") == ""..getElementData(source, "AC-BauTag").."" then objbau = getElementData(source, "AC-BauCol") bauid = getElementData(source, "AC-BauId") bautag = getElementData(source, "AC-BauTag") baupos = fromJSON(getElementData(source, "AC-BauPos")) baudist = getElementData(source, "AC-BauDist") visiblebau = true if not isEventHandlerAdded("onClientRender", root, acdxbaus) then addEventHandler ("onClientRender", root, acdxbaus) end end end end end end addEventHandler("onClientColShapeHit", root, onHitdoorcol) --- function onLeavedoorcol(hitElement, dim) if hitElement ~= localPlayer then else if getElementData(source, "AC-BauId") ~= colissionbau then if dim then objbau = nil bauid = nil bautag = nil baupos = nil baudist = nil visiblebau = false if isEventHandlerAdded("onClientRender", root, acdxbaus) then removeEventHandler ("onClientRender", root, acdxbaus) end if isEventHandlerAdded("onClientRender", root, dxmenub1) then removeEventHandler("onClientRender", root, dxmenub1) showCursor(false) qntd = {} table.insert(qntd, "QTD") selected = nil selected2 = nil end end end end end addEventHandler("onClientColShapeLeave", root, onLeavedoorcol) --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --- CLICKS INV --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- function clicksinv() if isEventHandlerAdded("onClientRender", root, dxmenub1) then if (selected == nil) then items = exports.acrp:ACGetItens() local column, row = y*0, y*0 local limitColumn = 4 local itemsToDisplay = #items local distanceBetweenBoxes = 5 local distanceBetweenBoxes2 = 5 local distanceBetweenBoxes3 = 5 local itemWidth = x*100 local itemHeight = y*120 for i = 1, itemsToDisplay do itemHere = items[i] if getElementData(objbau, itemHere[2]) >= 1 then if itemHere then local x2 = column * (itemWidth + distanceBetweenBoxes) local y2 = y*row * (itemHeight + distanceBetweenBoxes) local x3 = column * (itemWidth + distanceBetweenBoxes2) local y3 = row * (itemHeight + distanceBetweenBoxes3) if isCursorOnElement(x2 + x*770, y3 + y*130, itemWidth, itemHeight) then selected = i end column = column + 1 if (column > limitColumn) then column = 0 row = row + 1 end end end end else items = exports.acrp:ACGetItens() local column, row = y*0, y*0 local limitColumn = 4 local itemsToDisplay = #items local distanceBetweenBoxes = 5 local distanceBetweenBoxes2 = 5 local distanceBetweenBoxes3 = 5 local itemWidth = x*100 local itemHeight = y*120 for i = 1, itemsToDisplay do itemHere = items[i] if getElementData(objbau, itemHere[2]) >= 1 then if itemHere then local x2 = column * (itemWidth + distanceBetweenBoxes) local y2 = y*row * (itemHeight + distanceBetweenBoxes) local x3 = column * (itemWidth + distanceBetweenBoxes2) local y3 = row * (itemHeight + distanceBetweenBoxes3) --- < COMPRAR > --- if selected == i then if isCursorOnElement(x*100, y*130, x*500, y*500) then if table.concat(qntd) == "" then selected = nil else if table.concat(qntd) == " " then selected = nil else if table.concat(qntd) == "QTD" then selected = nil else triggerServerEvent("AC-TirarBaú", localPlayer, localPlayer, objbau, itemHere[1], table.concat(qntd)) selected = nil end end end elseif not isCursorOnElement(x*100, y*130, x*500, y*500) then selected = nil end end column = column + 1 if (column > limitColumn) then column = 0 row = row + 1 end end end end end end end bindKey("mouse1", "both", clicksinv) --- function clicksinv2() if isEventHandlerAdded("onClientRender", root, dxmenub1) then if (selected2 == nil) then items = exports.acrp:ACGetItens() local column, row = y*0, y*0 local limitColumn = 4 local itemsToDisplay = #items local distanceBetweenBoxes = 5 local distanceBetweenBoxes2 = 5 local distanceBetweenBoxes3 = 5 local itemWidth = x*100 local itemHeight = y*120 for i = 1, itemsToDisplay do itemHere = items[i] if itemHere then if itemHere and getElementData(localPlayer, itemHere[2]) >= 1 then local x2 = column * (itemWidth + distanceBetweenBoxes) local y2 = y*row * (itemHeight + distanceBetweenBoxes) local x3 = column * (itemWidth + distanceBetweenBoxes2) local y3 = row * (itemHeight + distanceBetweenBoxes3) if isCursorOnElement(x2 + x*100, y3 + y*130, itemWidth, itemHeight) then selected2 = i end column = column + 1 if (column > limitColumn) then column = 0 row = row + 1 end end end end else items = exports.acrp:ACGetItens() local column, row = y*0, y*0 local limitColumn = 4 local itemsToDisplay = #items local distanceBetweenBoxes = 5 local distanceBetweenBoxes2 = 5 local distanceBetweenBoxes3 = 5 local itemWidth = x*100 local itemHeight = y*120 for i = 1, itemsToDisplay do itemHere = items[i] if itemHere then if itemHere and getElementData(localPlayer, itemHere[2]) >= 1 then local x2 = column * (itemWidth + distanceBetweenBoxes) local y2 = row * (itemHeight + distanceBetweenBoxes) local x3 = column * (itemWidth + distanceBetweenBoxes2) local y3 = row * (itemHeight + distanceBetweenBoxes3) --- < USAR > --- if selected2 == i then --- < LIXO > --- if isCursorOnElement(x*770, y*130, x*500, y*500) then if table.concat(qntd) == "" then selected2 = nil else if table.concat(qntd) == " " then selected2 = nil else if table.concat(qntd) == "QTD" then selected2 = nil else triggerServerEvent("AC-ColocarBaú", localPlayer, localPlayer, objbau, itemHere[1], table.concat(qntd)) selected2 = nil end end end elseif not isCursorOnElement(x*770, y*130, x*500, y*500) then selected2 = nil end end column = column + 1 if (column > limitColumn) then column = 0 row = row + 1 end end end end end end end bindKey("mouse1", "both", clicksinv2) --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- VARIÁVEL --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- function dxDrawACRectangle(text, x, y, z, distance, color, color2, scale, font) if (getDistanceBetweenPoints3D(x, y, z, getElementPosition(getLocalPlayer()))) < distance then local rx = {getScreenFromWorldPosition( x, y, z )} local x2 = dxGetTextWidth(text, 1.0, font, true) if rx[1] and rx[2] and rx[3] then dxDrawRectangle(rx[1] - (10 + (0.5 * x2)), rx[2], x2 + 20, 25, color2) dxDrawText(text, rx[1], rx[2] + 27, rx[1], rx[2], color, scale, font, "center", "center", false, false, false, true, false) end 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 convert ( number ) return tonumber(("%.1f"?format(number)) end --- function isCursorOnElement( posX, posY, width, height ) if isCursorShowing( ) then local mouseX, mouseY = getCursorPosition( ) local clientW, clientH = guiGetScreenSize( ) local mouseX, mouseY = mouseX * clientW, mouseY * clientH if ( mouseX > posX and mouseX < ( posX + width ) and mouseY > posY and mouseY < ( posY + height ) ) then return true end end return false end --- function convertTime(ms) local min = math.floor(ms/60000) local sec = math.floor((ms/1000)%60) return min, sec 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 --- function roundedRectangle(x, y, w, h, borderColor, bgColor, postGUI) if (x and y and w and h) then if (not borderColor) then borderColor = tocolor(0, 255, 0, 200); end if (not bgColor) then bgColor = borderColor; end --> Background dxDrawRectangle(x, y, w, h, bgColor, true); --> Border dxDrawRectangle(x + 2, y - 1, w - 4, 1, borderColor, true); -- top dxDrawRectangle(x + 2, y + h, w - 4, 1, borderColor, true); -- bottom dxDrawRectangle(x - 1, y + 2, 1, h - 4, borderColor, true); -- left dxDrawRectangle(x + w, y + 2, 1, h - 4, borderColor, true); -- right end end --- function roundedRectangle2(x, y, w, h, borderColor, bgColor, type) if (x and y and w and h) then if (not borderColor) then borderColor = tocolor(0, 255, 0, 200); end if (not bgColor) then bgColor = borderColor; end --> Background dxDrawRectangle(x, y, w, h, bgColor, true); --> Border dxDrawRectangle(x - 1, y - 1, w + 1, 1, borderColor, true); -- top dxDrawRectangle(x - 1, y + h, w + 1, 1, borderColor, true); -- bottom dxDrawRectangle(x - 1, y, 1, h, borderColor, true); -- left dxDrawRectangle(x + w, y - 1, 1, h + 2, borderColor, true); -- right end end --- function roundedRectangle3(x, y, w, h, borderColor, bgColor, type) if (x and y and w and h) then if (not borderColor) then borderColor = tocolor(0, 255, 0, 200); end if (not bgColor) then bgColor = borderColor; end --> Background dxDrawRectangle(x, y, w, h, bgColor, true); --> Border dxDrawRectangle(x - 1, y - 1, w + 1, 5, borderColor, true); -- top dxDrawRectangle(x - 1, y + h, w + 6, 5, borderColor, true); -- bottom dxDrawRectangle(x - 1, y, 5, h, borderColor, true); -- left dxDrawRectangle(x + w, y - 1, 5, h + 2, borderColor, true); -- right end end --- local alfabetLacinski = { ["1"] = {true, 1}, ["2"] = {true, 1}, ["3"] = {true, 1}, ["4"] = {true, 1}, ["5"] = {true, 1}, ["6"] = {true, 1}, ["7"] = {true, 1}, ["8"] = {true, 1}, ["9"] = {true, 1}, ["0"] = {true, 1}, } function dxdigitarqtd(character) if isEventHandlerAdded("onClientRender", root, dxmenub1) then if digqtd == true then if alfabetLacinski[character] then table.insert(qntd, character) end end end end addEventHandler("onClientCharacter", root, dxdigitarqtd) --- function apagar() if isEventHandlerAdded("onClientRender", root, dxmenub1) then if digqtd == true then table.remove(qntd, #qntd) end end end bindKey("backspace", "down", apagar) I tried to put it like this same error continues
  2. I need help, I'm getting the following error: bad argument #1 to `format` (number expected, got bolean --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- variable --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- function dxDrawACRectangle(text, x, y, z, distance, color, color2, scale, font) if (getDistanceBetweenPoints3D(x, y, z, getElementPosition(getLocalPlayer()))) < distance then local rx = {getScreenFromWorldPosition( x, y, z )} local x2 = dxGetTextWidth(text, 1.0, font, true) if rx[1] and rx[2] and rx[3] then dxDrawRectangle(rx[1] - (10 + (0.5 * x2)), rx[2], x2 + 20, 25, color2) dxDrawText(text, rx[1], rx[2] + 27, rx[1], rx[2], color, scale, font, "center", "center", false, false, false, true, false) end 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 convert ( number ) return tonumber(("%.1f"?formatNumber(number)) end --- function isCursorOnElement( posX, posY, width, height ) if isCursorShowing( ) then local mouseX, mouseY = getCursorPosition( ) local clientW, clientH = guiGetScreenSize( ) local mouseX, mouseY = mouseX * clientW, mouseY * clientH if ( mouseX > posX and mouseX < ( posX + width ) and mouseY > posY and mouseY < ( posY + height ) ) then return true end end return false end --- function convertTime(ms) local min = math.floor(ms/60000) local sec = math.floor((ms/1000)%60) return min, sec 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 --- function roundedRectangle(x, y, w, h, borderColor, bgColor, postGUI) if (x and y and w and h) then if (not borderColor) then borderColor = tocolor(0, 255, 0, 200); end if (not bgColor) then bgColor = borderColor; end --> Background dxDrawRectangle(x, y, w, h, bgColor, true); --> Border dxDrawRectangle(x + 2, y - 1, w - 4, 1, borderColor, true); -- top dxDrawRectangle(x + 2, y + h, w - 4, 1, borderColor, true); -- bottom dxDrawRectangle(x - 1, y + 2, 1, h - 4, borderColor, true); -- left dxDrawRectangle(x + w, y + 2, 1, h - 4, borderColor, true); -- right end end --- function roundedRectangle2(x, y, w, h, borderColor, bgColor, type) if (x and y and w and h) then if (not borderColor) then borderColor = tocolor(0, 255, 0, 200); end if (not bgColor) then bgColor = borderColor; end --> Background dxDrawRectangle(x, y, w, h, bgColor, true); --> Border dxDrawRectangle(x - 1, y - 1, w + 1, 1, borderColor, true); -- top dxDrawRectangle(x - 1, y + h, w + 1, 1, borderColor, true); -- bottom dxDrawRectangle(x - 1, y, 1, h, borderColor, true); -- left dxDrawRectangle(x + w, y - 1, 1, h + 2, borderColor, true); -- right end end --- function roundedRectangle3(x, y, w, h, borderColor, bgColor, type) if (x and y and w and h) then if (not borderColor) then borderColor = tocolor(0, 255, 0, 200); end if (not bgColor) then bgColor = borderColor; end --> Background dxDrawRectangle(x, y, w, h, bgColor, true); --> Border dxDrawRectangle(x - 1, y - 1, w + 1, 5, borderColor, true); -- top dxDrawRectangle(x - 1, y + h, w + 6, 5, borderColor, true); -- bottom dxDrawRectangle(x - 1, y, 5, h, borderColor, true); -- left dxDrawRectangle(x + w, y - 1, 5, h + 2, borderColor, true); -- right end end --- local alfabetLacinski = { ["1"] = {true, 1}, ["2"] = {true, 1}, ["3"] = {true, 1}, ["4"] = {true, 1}, ["5"] = {true, 1}, ["6"] = {true, 1}, ["7"] = {true, 1}, ["8"] = {true, 1}, ["9"] = {true, 1}, ["0"] = {true, 1}, } function dxdigitarqtd(character) if isEventHandlerAdded("onClientRender", root, dxmenub1) then if digqtd == true then if alfabetLacinski[character] then table.insert(qntd, character) end end end end addEventHandler("onClientCharacter", root, dxdigitarqtd) --- function apagar() if isEventHandlerAdded("onClientRender", root, dxmenub1) then if digqtd == true then table.remove(qntd, #qntd) end end end bindKey("backspace", "down", apagar) Where is it : : function convert ( number ) return tonumber(("%.1f"formatNumber(number)) end in reality and to be: function convert ( number ) return tonumber(("%.1f"?format(number)) end but we two ways of error
×
×
  • Create New...