Nome Nome Posted September 7, 2020 Share Posted September 7, 2020 local screenW,screenH = guiGetScreenSize() local resW, resH = 1366,768 local x, y = (screenW/resW), (screenH/resH) PainelLoja = false function Painel () Imagens = getElementData(getLocalPlayer(), "Imagens") dxDrawImage(screenW * 0.5879, screenH * 0.2591, screenW * 0.4023, screenH * 0.5547, "Imagens/Fundo.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(screenW * 0.5879, screenH * 0.3060, screenW * 0.1953, screenH * 0.4609, "Portfolio/"..Imagens..".png", 0, 0, 0, tocolor(255, 255, 255, 255), false) if cursorPosition(screenW * 0.7939, screenH * 0.3060, screenW * 0.1953, screenH * 0.0391) then dxDrawImage(screenW * 0.7939, screenH * 0.3060, screenW * 0.1953, screenH * 0.0391, "Imagens/Mascara-1.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) end if cursorPosition(screenW * 0.7939, screenH * 0.3529, screenW * 0.1953, screenH * 0.0391) then dxDrawImage(screenW * 0.7939, screenH * 0.3529, screenW * 0.1953, screenH * 0.0391, "Imagens/Mascara-2.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) end if cursorPosition(screenW * 0.7939, screenH * 0.3997, screenW * 0.1953, screenH * 0.0391) then dxDrawImage(screenW * 0.7939, screenH * 0.3997, screenW * 0.1953, screenH * 0.0391, "Imagens/Mascara-3.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) end if cursorPosition(screenW * 0.7939, screenH * 0.4466, screenW * 0.1953, screenH * 0.0391) then dxDrawImage(screenW * 0.7939, screenH * 0.4466, screenW * 0.1953, screenH * 0.0391, "Imagens/Mascara-4.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) end if cursorPosition(screenW * 0.7939, screenH * 0.4935, screenW * 0.1953, screenH * 0.0391) then dxDrawImage(screenW * 0.7939, screenH * 0.4935, screenW * 0.1953, screenH * 0.0391, "Imagens/Mascara-5.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) end if cursorPosition(screenW * 0.7939, screenH * 0.5404, screenW * 0.1953, screenH * 0.0391) then dxDrawImage(screenW * 0.7939, screenH * 0.5404, screenW * 0.1953, screenH * 0.0391, "Imagens/Mascara-6.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) end if cursorPosition(screenW * 0.7939, screenH * 0.5872, screenW * 0.1953, screenH * 0.0391) then dxDrawImage(screenW * 0.7939, screenH * 0.5872, screenW * 0.1953, screenH * 0.0391, "Imagens/Mascara-7.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) end if cursorPosition(screenW * 0.7939, screenH * 0.6341, screenW * 0.1953, screenH * 0.0391) then dxDrawImage(screenW * 0.7939, screenH * 0.6341, screenW * 0.1953, screenH * 0.0391, "Imagens/Mascara-8.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) end if cursorPosition(screenW * 0.7949, screenH * 0.6810, screenW * 0.1953, screenH * 0.0391) then dxDrawImage(screenW * 0.7949, screenH * 0.6810, screenW * 0.1953, screenH * 0.0391, "Imagens/Mascara-9.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) end if cursorPosition(screenW * 0.7939, screenH * 0.7279, screenW * 0.1953, screenH * 0.0391) then dxDrawImage(screenW * 0.7939, screenH * 0.7279, screenW * 0.1953, screenH * 0.0391, "Imagens/Mascara-10.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) end if cursorPosition(screenW * 0.7939, screenH * 0.7747, screenW * 0.1953, screenH * 0.0391) then dxDrawImage(screenW * 0.7939, screenH * 0.7747, screenW * 0.1953, screenH * 0.0391, "Imagens/Fechar.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) end if cursorPosition(screenW * 0.6074, screenH * 0.7773, screenW * 0.0244, screenH * 0.0326) then dxDrawImage(screenW * 0.6074, screenH * 0.7773, screenW * 0.0244, screenH * 0.0326, "Imagens/Seta.png", -180, 0, 0, tocolor(255, 255, 255, 255), false) end if cursorPosition(screenW * 0.7393, screenH * 0.7773, screenW * 0.0244, screenH * 0.0326) then dxDrawImage(screenW * 0.7393, screenH * 0.7773, screenW * 0.0244, screenH * 0.0326, "Imagens/Seta.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) end end function SelecionarImagens(_,state) if isEventHandlerAdded("onClientRender", getRootElement(), Painel) then if state == "down" then if isCursorOnElement(screenW * 0.6074, screenH * 0.7773, screenW * 0.0244, screenH * 0.0326) then if Imagens > 1 then setElementData(getLocalPlayer(), "Imagens", Imagens - 1) end end if isCursorOnElement(screenW * 0.7393, screenH * 0.7773, screenW * 0.0244, screenH * 0.0326) then if Imagens < 10 then setElementData(getLocalPlayer(), "Imagens", Imagens + 1) end end end end end addEventHandler("onClientClick", root, SelecionarImagens) function AbrirPainel() if PainelLoja == false then addEventHandler ("onClientRender", root, Painel) showCursor (true) PainelLoja = true end end addEvent("PainelAbrir", true) addEventHandler("PainelAbrir", getRootElement(), AbrirPainel) function FecharPainelLoja () if PainelLoja == true then removeEventHandler ( "onClientRender", root, Painel ) showCursor ( false ) PainelLoja = false end end addEvent ( "Fechar:PainelLoja", true) addEventHandler ( "Fechar:PainelLoja", root, FecharPainelLoja ) function FecharXLoja (_,state) if PainelLoja == true then if state == "down" then if isCursorOnElement ( screenW * 0.7939, screenH * 0.7747, screenW * 0.1953, screenH * 0.0391 ) then removeEventHandler ( "onClientRender", root, Painel ) showCursor ( false ) PainelLoja = false end end end end addEventHandler ( "onClientClick", root, FecharXLoja ) function CompMask1 (_,state) if PainelLoja == true then if state == "down" then if isCursorOnElement(screenW * 0.7939, screenH * 0.3060, screenW * 0.1953, screenH * 0.0391) then triggerServerEvent ("CompMask11", getLocalPlayer(), localPlayer) end end end end addEventHandler ("onClientClick", root, CompMask1) function CompMask2 (_,state) if PainelLoja == true then if state == "down" then if isCursorOnElement(screenW * 0.7939, screenH * 0.3529, screenW * 0.1953, screenH * 0.0391) then triggerServerEvent ("CompMask21", getLocalPlayer(), localPlayer) end end end end addEventHandler ("onClientClick", root, CompMask2) function CompMask3 (_,state) if PainelLoja == true then if state == "down" then if isCursorOnElement(screenW * 0.7939, screenH * 0.3997, screenW * 0.1953, screenH * 0.0391) then triggerServerEvent ("CompMask31", getLocalPlayer(), localPlayer) end end end end addEventHandler ("onClientClick", root, CompMask3) function CompMask4 (_,state) if PainelLoja == true then if state == "down" then if isCursorOnElement(screenW * 0.7939, screenH * 0.4466, screenW * 0.1953, screenH * 0.0391) then triggerServerEvent ("CompMask41", getLocalPlayer(), localPlayer) end end end end addEventHandler ("onClientClick", root, CompMask4) function CompMask5 (_,state) if PainelLoja == true then if state == "down" then if isCursorOnElement(screenW * 0.7939, screenH * 0.4935, screenW * 0.1953, screenH * 0.0391) then triggerServerEvent ("CompMask51", getLocalPlayer(), localPlayer) end end end end addEventHandler ("onClientClick", root, CompMask5) function CompMask6 (_,state) if PainelLoja == true then if state == "down" then if isCursorOnElement(screenW * 0.7939, screenH * 0.5404, screenW * 0.1953, screenH * 0.0391) then triggerServerEvent ("CompMask61", getLocalPlayer(), localPlayer) end end end end addEventHandler ("onClientClick", root, CompMask6) function CompMask7 (_,state) if PainelLoja == true then if state == "down" then if isCursorOnElement(screenW * 0.7939, screenH * 0.5872, screenW * 0.1953, screenH * 0.0391) then triggerServerEvent ("CompMask71", getLocalPlayer(), localPlayer) end end end end addEventHandler ("onClientClick", root, CompMask7) function CompMask8 (_,state) if PainelLoja == true then if state == "down" then if isCursorOnElement(screenW * 0.7939, screenH * 0.6341, screenW * 0.1953, screenH * 0.0391) then triggerServerEvent ("CompMask81", getLocalPlayer(), localPlayer) end end end end addEventHandler ("onClientClick", root, CompMask8) function CompMask9 (_,state) if PainelLoja == true then if state == "down" then if isCursorOnElement(screenW * 0.7949, screenH * 0.6810, screenW * 0.1953, screenH * 0.0391) then triggerServerEvent ("CompMask91", getLocalPlayer(), localPlayer) end end end end addEventHandler ("onClientClick", root, CompMask9) function CompMask10 (_,state) if PainelLoja == true then if state == "down" then if isCursorOnElement(screenW * 0.7939, screenH * 0.7279, screenW * 0.1953, screenH * 0.0391) then triggerServerEvent ("CompMask101", getLocalPlayer(), localPlayer) end end end end addEventHandler ("onClientClick", root, CompMask10) 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 cursorPosition(x, y, width, height) if (not isCursorShowing()) then return false end local sx, sy = guiGetScreenSize() local cx, cy = getCursorPosition() local cx, cy = (cx*sx), (cy*sy) if (cx >= x and cx <= x + width) and (cy >= y and cy <= y + height) then return true else return false end 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 Se algum puder me ajudar pois eu não consegui arrumar. Imagem dos erros. https://imgur.com/9F1KMh9 Link to comment
Nome Nome Posted September 8, 2020 Author Share Posted September 8, 2020 Movimentando Link to comment
Other Languages Moderators Lord Henry Posted September 8, 2020 Other Languages Moderators Share Posted September 8, 2020 (edited) Na próxima vez, aguarde 48h antes de reviver seu tópico. Era mais fácil ter simplesmente colado o erro aqui em vez de ter o trabalho de upar uma imagem. Quote Error: C.lua: 15: attempt to cocatenate global 'Imagens' (a boolean value) Error: C.lua: 67: attempt to compare boolean with number No primeiro erro, ele está reclamando que a variável Imagens é booleana. (provavelmente false) No segundo erro, ele diz que não é possível comparar se false é menor que 10. O que eu sugiro que você faça, é trocar aquela linha 9 onde ele seta o valor de Imagens, para isso: Imagens = getElementData(getLocalPlayer(), "Imagens") or "0" Mas vale lembrar que a linha 15 (aparece na linha 12 que vc enviou) continuará dando erro se você não tiver a imagem "0.png" dentro da pasta "Portfolio". Edited September 8, 2020 by Lord Henry 1 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