#DaNiLiN Posted December 27, 2018 Share Posted December 27, 2018 Olá, Bom montei uma tabela com alguns números aleatórios e adicionei o math.random para que aciona-se um número aleatório até ai tudo bem, Mas estou com dificuldades apenas de verificar qual numero foi acionado em uma editbox :\ local Tabela_Senha = {"1234", "4321", "3421"} function teste () outputChatBox("< "..Tabela_Senha[math.random(#Tabela_Senha)].." >") end addCommandHandler("a", teste) function Dx_Portoes () dxDrawImage(x*0, y*0, x*1366, y*768, "Img/Digitos.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(x*0, y*0, x*1366, y*768, "Img/B_Block.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) if getElementData(nameBox, "text") == "".. (#Tabela_Senha) .."" then -- Minha dúvida está nesta linha. dxDrawImage(x*0, y*0, x*1366, y*768, "Img/B_Acesso.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) end dxDrawEditBox(" Digite a Senha", 553, 203, 281, 59, false, 4, nameBox) end addEventHandler("onClientRender", root, Dx_Portoes) Link to comment
Other Languages Moderators androksi Posted December 27, 2018 Other Languages Moderators Share Posted December 27, 2018 Basta criar uma variável. local Tabela_Senha = { "1234", "4321", "3421" }; function teste ( ) randomNumber = math.random ( #Tabela_Senha ); outputChatBox ( "< "..Tabela_Senha[randomNumber].." >" ); end addCommandHandler ( "a", teste ) function Dx_Portoes ( ) dxDrawImage ( x * 0, y * 0, x * 1366, y * 768, "Img/Digitos.png", 0, 0, 0, tocolor ( 255, 255, 255, 255 ), false ); dxDrawImage ( x * 0, y * 0, x * 1366, y * 768, "Img/B_Block.png", 0, 0, 0, tocolor ( 255, 255, 255, 255 ), false ); if ( getElementData ( nameBox, "text" ) == tostring ( Tabela_Senha[randomNumber] ) ) then -- Minha dúvida está nesta linha. dxDrawImage ( x * 0, y * 0, x * 1366, y * 768, "Img/B_Acesso.png", 0, 0, 0, tocolor ( 255, 255, 255, 255 ), false ); end dxDrawEditBox ( " Digite a Senha", 553, 203, 281, 59, false, 4, nameBox ); end addEventHandler ( "onClientRender", root, Dx_Portoes ) 1 Link to comment
#DaNiLiN Posted December 27, 2018 Author Share Posted December 27, 2018 Muito Obrigado. 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