Tks15 Posted March 30, 2018 Share Posted March 30, 2018 (edited) Pessoal , meu outro problema é o seguinte quando eu clico no lugar indicado no script acontece nada 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 veiculo2() if isCursorOnElement(543, 240, 123, 40 ) then ---- 1 outputChatBox("Funcionou",source) end end addEventHandler("onClientClick",getRootElement(),veiculo2) CÓDIGO COMPLETO 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 -- PAINEL -- pvip = false function Entrada() local screenH, screenW = guiGetScreenSize() local x, y = (screenH/1366), (screenW/768) dxDrawRectangle(x*485, y*250, 333, 274, tocolor(255, 254, 254, 42), false) dxDrawRectangle( x*485, y*250, 333, 40, tocolor(254, 178, 57, 254), false) dxDrawText("PAINEL VIP", x*486 + 1, y*254 + 1, 812 + 1, 285 + 1, tocolor(0, 0, 0, 255), 1.50, "sans", "center", "center", false, false, false, false, false) dxDrawText("PAINEL VIP", x*486, y*254, 812, 285, tocolor(254, 187, 3, 254), 1.50, "sans", "center", "center", false, false, false, false, false) dxDrawText("JOGADOR", x*485 + 1, y*300 + 1, 636 + 1, 346 + 1, tocolor(0, 0, 0, 255), 1.30, "default", "center", "center", false, false, false, false, false) dxDrawText("JOGADOR", x*485, y*300, 636, 346, tocolor(254, 254, 254, 254), 1.30, "default", "center", "center", false, false, false, false, false) dxDrawText("VEICULO", x*657 + 1, y*300 + 1, 808 + 1, 346 + 1, tocolor(0, 0, 0, 255), 1.30, "default", "center", "center", false, false, false, false, false) dxDrawText("VEICULO", x*657, y*300, 808, 346, tocolor(254, 254, 254, 254), 1.30, "default", "center", "center", false, false, false, false, false) dxDrawRectangle( x*514, y*351, 98, 86, tocolor(255, 255, 255, 255), false) dxDrawRectangle( x*684, y*351, 98, 86, tocolor(255, 255, 255, 255), false) dxDrawText("//", 629, 508, 684, 524, tocolor(253, 174, 46, 254), 1.00, "default-bold", "center", "center", false, false, false, false, false) end function veiculo2() if isCursorOnElement( x*514, y*351, 98, 86 ) then outputChatBox("Funcionou",source) end end addEventHandler("onClientClick",getRootElement(),veiculo2) function CriarEvent() if pvip == false then showCursor (true) addEventHandler ("onClientRender", root, Entrada) pvip = true else if pvip == true then showCursor(false) removeEventHandler("onClientRender", root, Entrada) pvip = false end end end addCommandHandler("pvip", CriarEvent) Edited March 30, 2018 by Tks15 Link to comment
DNL291 Posted March 30, 2018 Share Posted March 30, 2018 Esse "funcionar" significa mostrar a mensagem no chat, certo? Porque essa é a única coisa que vai acontecer quando clicar. Seu código tem alguns problemas: 'source' em outputChatBox será nulo, e você está usando no argumento que é a cor Use os parâmetros button e state em "onClientClick"; e a variável pvip e a função isMainMenuActive pro painel-dx funcionar corretamente e de uma forma mais otimizada. Você está usando else na linha 43, que poderia ser elseif pvip == true then Use as variáveis de guiGetScreenSize fora do "onClientRender"; Você também colocou a variável screenH e screenW invertidas (linha 17) 1 Link to comment
Tks15 Posted March 30, 2018 Author Share Posted March 30, 2018 (edited) Obrigado, @DNL291 , Consegui Fazer O Painel Funcionar =) Edited March 31, 2018 by Tks15 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