Pedro Colto Posted February 29, 2016 Share Posted February 29, 2016 Alguém pode me dar a base desse exemplo abaixo: GUIEditor = { window = {}, staticimage = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(0.63, 0.21, 0.25, 0.34, "", true) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.staticimage[1] = guiCreateStaticImage(0.14, 0.21, 0.25, 0.28, ":guieditor/client/colorpicker/palette.png", true, GUIEditor.window[1]) --- quero que esta imagem set em um random de 3 posições no caso esta padrão e mais dua > (0.44, 0.21, 0.25, 0.28) e (0.15, 0.57, 0.25, 0.28) end ) Link to comment
FelipeMallmann Posted February 29, 2016 Share Posted February 29, 2016 Você pode usar o math.random para gerar um valor aleatorio entre 2 numeros e depois if e else para definir o que acontece em cada caso. GUIEditor = { window = {}, staticimage = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(0.63, 0.21, 0.25, 0.34, "", true) guiWindowSetSizable(GUIEditor.window[1], false) local random = math.random(1,3) local a = 0.14 local b = 0.21 if (random == 2) then a = 0.44 end if (random == 3) then a = 0.15 b = 0.57 end GUIEditor.staticimage[1] = guiCreateStaticImage(a, b, 0.25, 0.28, ":guieditor/client/colorpicker/palette.png", true, GUIEditor.window[1]) end ) 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