ODutii Posted August 24, 2019 Posted August 24, 2019 Estou querendo criar um script, ao entrar no carro, aparece um botão na minha tela, como que faço para que esse botão mude de cor quando eu apertar uma tecla? dentro do veiculo.
Moderators Lord Henry Posted August 24, 2019 Moderators Posted August 24, 2019 onVehicleEnter bindKey Eu te ajudei ou achou meu comentário útil? Não esqueça de deixar um Thanks! Minhas contribuições para a comunidade: LordHenry - MTA Wiki Profile Inscreva-se no meu canal do YouTube: Lord Henry - Entertainment Discord Oficial do MTA: https://mtasa.com/discord Blacklist e Whitelist de Scripters: Planilha Por favor, não me envie mensagens privadas solicitando suporte. Crie um tópico no fórum em vez disso.
ODutii Posted August 24, 2019 Author Posted August 24, 2019 Sim mas quero que o dx mude de cor ao apertar tecla
Moderators Lord Henry Posted August 24, 2019 Moderators Posted August 24, 2019 (edited) Coloque as cores em variáveis e altere esses valores das variáveis ao apertar a tecla. Edited August 24, 2019 by Lord Henry Eu te ajudei ou achou meu comentário útil? Não esqueça de deixar um Thanks! Minhas contribuições para a comunidade: LordHenry - MTA Wiki Profile Inscreva-se no meu canal do YouTube: Lord Henry - Entertainment Discord Oficial do MTA: https://mtasa.com/discord Blacklist e Whitelist de Scripters: Planilha Por favor, não me envie mensagens privadas solicitando suporte. Crie um tópico no fórum em vez disso.
ODutii Posted August 24, 2019 Author Posted August 24, 2019 35 minutes ago, Lord Henry said: Coloque as cores em variáveis e altere esses valores ao apertar a tecla. local apertou = false function Vel(player,_) local vehicle = getPedOccupiedVehicle( getLocalPlayer() ) if ( vehicle ) then for i, player in ipairs(getElementsByType("player")) do bindKey(player,"1", "down", "mudarcor") if apertou == false then dxDrawRectangle(0, 182, 295, 180, tocolor(186, 110, 68, 255), false) else dxDrawRectangle(624, 182, 295, 180, tocolor(255,255,255, 255), false) end end end end addEventHandler("onClientRender", root, Vel) addCommandHandler("mudarcor",Vel) Não funciona esse ai
DNL291 Posted August 24, 2019 Posted August 24, 2019 Exemplo: local dxRecColor = { { 255,255,255, 255 }, { 186, 110, 68, 255 } } local state = 1 function changecolor() if getPedOccupiedVehicle( localPlayer ) then state = (state == 1) and 2 or 1 end end addCommandHandler("mudarcor",changecolor) bindKey("1", "down", "mudarcor") function Vel() local vehicle = getPedOccupiedVehicle( getLocalPlayer() ) if ( vehicle ) then local r,g,b,a = unpack(dxRecColor[state]) dxDrawRectangle(0, 182, 295, 180, tocolor(r,g,b,a), false) end end addEventHandler("onClientRender", root, Vel) Please do not PM me with scripting related question nor support, use the forums instead.
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