WASSIm. Posted July 10, 2013 Share Posted July 10, 2013 hi guys i have question. how make GUI dont create again to onClientRender? Link to comment
manve1 Posted July 10, 2013 Share Posted July 10, 2013 Don't put it in the event? for example: local window = guiCreateWindow(...) addEventHandler("onClientRender",getRootElement(), function() guiSetVisible(window,false) -- or whatever end ) Link to comment
WASSIm. Posted July 10, 2013 Author Share Posted July 10, 2013 Don't put it in the event?for example: local window = guiCreateWindow(...) addEventHandler("onClientRender",getRootElement(), function() guiSetVisible(window,false) -- or whatever end ) i need windows in onClientRender but if make it its create again addEventHandler("onClientRender",getRootElement(), function() window = guiCreateWindow(...) end ) Link to comment
PaiN^ Posted July 10, 2013 Share Posted July 10, 2013 addEventHandler( "onClientRnder", root, function( ) if window then return end window = guiCreateWindow( ... ) end ) Link to comment
WASSIm. Posted July 10, 2013 Author Share Posted July 10, 2013 addEventHandler( "onClientRnder", root, function( ) if window then return end window = guiCreateWindow( ... ) end ) now windows not working and if make local nothing change Link to comment
WASSIm. Posted July 10, 2013 Author Share Posted July 10, 2013 Post whole code! function main ( ) start = getTickCount() addEventHandler ("onClientRender", root, move) end bindKey ("F2","down", main) function move ( ) local x = 0.5 local y = 0.5 local w = 0.6 local h = 0.6 local now = getTickCount() local elapsedTime = now - start local endtime = start + 1000 local duration = endtime - start local progress = elapsedTime / duration local w1, h1, z = interpolateBetween ( 0, 0, 0, w, h, 0, progress, "OutInBounce") x1 = x-(w1/2) y1 = y-(h1/2) local dxgui = guidxCreateWindow(x1,y1,w1, h1,"SHOP PANEL",70) end Link to comment
WASSIm. Posted July 11, 2013 Author Share Posted July 11, 2013 it is guidxCreateWindow its function i make it with guiCreateStaticImage Link to comment
itoko Posted July 11, 2013 Share Posted July 11, 2013 That should be enough: function main ( ) start = getTickCount() addEventHandler ("onClientRender", root, move) end bindKey ("F2","down", main) function move ( ) if not dxgui then local x = 0.5 local y = 0.5 local w = 0.6 local h = 0.6 local now = getTickCount() local elapsedTime = now - start local endtime = start + 1000 local duration = endtime - start local progress = elapsedTime / duration local w1, h1, z = interpolateBetween ( 0, 0, 0, w, h, 0, progress, "OutInBounce") x1 = x-(w1/2) y1 = y-(h1/2) local dxgui = guidxCreateWindow(x1,y1,w1, h1,"SHOP PANEL",70) end end Link to comment
denny199 Posted July 11, 2013 Share Posted July 11, 2013 Please, show us the guidxCreateWindow function, also Say to us what you want to make I gues popping a image up? Link to comment
WASSIm. Posted July 12, 2013 Author Share Posted July 12, 2013 function guidxCreateWindow(x,y,w,h,text,alpha) local sx,sy = guiGetScreenSize ( ) local win = guiCreateStaticImage( sx*x,sy*y,sx*w,sy*h, "black.png", false) local wx, wy = guiGetSize ( win, false ) guiSetProperty( win, "Alpha", alpha) local winup = guiCreateStaticImage( 0,0,1,0.1, "winup.jpg", true, win ) local text = guiCreateLabel(0,0,1, 1,text,true, winup) guiSetProperty( text, "Alpha", 300) guiLabelSetHorizontalAlign(text, "center") guiLabelSetVerticalAlign(text, "center") guiSetFont ( text, guiCreateFont( "font.ttf", 30 ) ) return win end function main ( ) start = getTickCount() addEventHandler ("onClientRender", root, pingstate) end bindKey ("F2","down", main) function pingstate ( ) if not dxgui then local x = 0.5 local y = 0.5 local w = 0.6 local h = 0.6 local now = getTickCount() local elapsedTime = now - start local endtime = start + 1000 local duration = endtime - start local progress = elapsedTime / duration local w1, h1, z = interpolateBetween ( 0, 0, 0, w, h, 0, progress, "OutInBounce") x1 = x-(w1/2) y1 = y-(h1/2) local dxgui = guidxCreateWindow(x1,y1,w1, h1,"SHOP PANEL",70) end end Link to comment
Castillo Posted July 12, 2013 Share Posted July 12, 2013 local dxgui = guidxCreateWindow(x1,y1,w1, h1,"SHOP PANEL",70) Remove the 'local' infront of it. Link to comment
WASSIm. Posted July 12, 2013 Author Share Posted July 12, 2013 local dxgui = guidxCreateWindow(x1,y1,w1, h1,"SHOP PANEL",70) Remove the 'local' infront of it. now not working Link to comment
denny199 Posted July 12, 2013 Share Posted July 12, 2013 it isn't working because you are creating the image every frame, use variables instead with guiSetPosition and guiSetSize Link to comment
WASSIm. Posted July 12, 2013 Author Share Posted July 12, 2013 Thanks its working in first time and now i changed something and now not moving and panel working function guidxCreateWindow(x,y,w,h,text) win = guiCreateStaticImage( x,y,w,h, "black.png", false) local wx, wy = guiGetSize ( win, false ) guiSetProperty( win, "Alpha", 70) local winup = guiCreateStaticImage( 0,0,1,0.1, "winup.jpg", true, win ) local text = guiCreateLabel(0,0,1, 1,text,true, winup) guiSetProperty( text, "Alpha", 300) guiLabelSetHorizontalAlign(text, "center") guiLabelSetVerticalAlign(text, "center") guiSetFont ( text, guiCreateFont( "font.ttf", 30 ) ) return win end function main ( ) if ( guiGetVisible ( win ) == true ) then start = getTickCount() addEventHandler ("onClientRender", root, move) else removeEventHandler ("onClientRender", root, move) end end addEventHandler ("onClientResourceStart", root, main) function move ( ) local x, y = guiGetPosition ( win, false ) local w, h = guiGetSize ( win, false ) local now = getTickCount() local elapsedTime = now - start local endtime = start + 1000 local duration = endtime - start local progress = elapsedTime / duration local w1, h1, z = interpolateBetween ( 0, 0, 0, w, h, 0, progress, "Linear") local x1 = x-(w1/2) local y1 = y-(h1/2) guiSetPosition ( win, x1, y1, false) guiSetSize ( win, w1, h1, false) end --------------------------------------------------TEST------------------------------------------- local sx,sy = guiGetScreenSize ( ) local dxgui = guidxCreateWindow( sx*0.5, sy*0.5, sx*0.6, sy*0.6,"TEST PANEL") guiSetVisible ( dxgui, false ) function test ( ) if ( guiGetVisible ( dxgui ) == false ) then guiSetVisible ( dxgui, true ) else guiSetVisible ( dxgui, false ) end end bindKey ("F2","down", test) Link to comment
Castillo Posted July 12, 2013 Share Posted July 12, 2013 function guidxCreateWindow(x,y,w,h,text) local win = guiCreateStaticImage( x,y,w,h, "black.png", false) local wx, wy = guiGetSize ( win, false ) guiSetProperty( win, "Alpha", 70) local winup = guiCreateStaticImage( 0,0,1,0.1, "winup.jpg", true, win ) local text = guiCreateLabel(0,0,1, 1,text,true, winup) guiSetProperty( text, "Alpha", 300) guiLabelSetHorizontalAlign(text, "center") guiLabelSetVerticalAlign(text, "center") guiSetFont ( text, guiCreateFont( "font.ttf", 30 ) ) return win end --------------------------------------------------TEST------------------------------------------- local sx,sy = guiGetScreenSize ( ) local dxgui = guidxCreateWindow( sx*0.5, sy*0.5, sx*0.6, sy*0.6,"TEST PANEL") guiSetVisible ( dxgui, false ) function move ( ) local x, y = guiGetPosition ( dxgui, false ) local w, h = guiGetSize ( dxgui, false ) local now = getTickCount() local elapsedTime = now - start local endtime = start + 1000 local duration = endtime - start local progress = elapsedTime / duration local w1, h1, z = interpolateBetween ( 0, 0, 0, w, h, 0, progress, "Linear") local x1 = x-(w1/2) local y1 = y-(h1/2) guiSetPosition ( dxgui, x1, y1, false) guiSetSize ( dxgui, w1, h1, false) end function test ( ) if ( guiGetVisible ( dxgui ) == false ) then guiSetVisible ( dxgui, true ) start = getTickCount() addEventHandler ("onClientRender", root, move) else guiSetVisible ( dxgui, false ) removeEventHandler ("onClientRender", root, move) end end bindKey ("F2","down", test) Link to comment
WASSIm. Posted July 13, 2013 Author Share Posted July 13, 2013 no no no i dont want that i make this because i want all ( guidxCreateWindow ) moving function main ( ) if ( guiGetVisible ( win ) == true ) then start = getTickCount() addEventHandler ("onClientRender", root, move) else removeEventHandler ("onClientRender", root, move) end end addEventHandler ("onClientResourceStart", root, main) Link to comment
Castillo Posted July 13, 2013 Share Posted July 13, 2013 You must make a different script then. Link to comment
iMr.3a[Z]eF Posted July 13, 2013 Share Posted July 13, 2013 And is guidxCreateWindow an element? Link to comment
WASSIm. Posted July 13, 2013 Author Share Posted July 13, 2013 You must make a different script then. what do you mean ? And is guidxCreateWindow an element? yes Link to comment
iMr.3a[Z]eF Posted July 13, 2013 Share Posted July 13, 2013 yes I don't see it in the elements page "Element" 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