boban88 Posted August 15, 2015 Share Posted August 15, 2015 Hello i have this client side script but not working and i have not idea why. Please try help me. local sW,sH = guiGetScreenSize ( ); local gUtils = { }; gUtils.guiW,gUtils.guiH = 398, 410; gUtils.posX,gUtils.posY = sW / 2 - gUtils.guiW / 2, sH / 2 - gUtils.guiH / 2; local gLabels = { }; local gButtons = { }; function createGui ( ) gWindow = dxDrawImage(gUtils.posX, gUtils.posY, 300, 300, 'images/up.png') guiWindowSetSizable ( gWindow, false ); guiSetVisible ( gWindow, false ); bindKey ( "F10", "down", showPanel ); end addEventHandler ( "onClientResourceStart", getResourceRootElement ( getThisResource ( ) ), createGui ) function showPanel ( ) if guiGetVisible ( gWindow ) then guiSetVisible ( gWindow, false ); showCursor ( false ); else guiSetVisible ( gWindow, true ); showCursor ( true ); end end no errors no warnings if i change image for guiCreateWindow then script working and show me GUI but image no. Thx for all replies. Link to comment
Moderators IIYAMA Posted August 15, 2015 Moderators Share Posted August 15, 2015 dxDraw functions don't create elements. Ones they are executed they will show a DX effect, which is only shown for 1 frame. If you want images in your gui, use: https://wiki.multitheftauto.com/wiki/Gu ... taticImage Link to comment
boban88 Posted August 15, 2015 Author Share Posted August 15, 2015 still not working i change function for this gWindow = guiCreateStaticImage(gUtils.posX, gUtils.posY, gUtils.guiW, gUtils.guiH, 'images/up.png') Link to comment
Moderators IIYAMA Posted August 15, 2015 Moderators Share Posted August 15, 2015 You forgot to define if it is relative or absolute. element guiCreateStaticImage ( float x, float y, float width, float height, string path, bool relative, [element parent = nil] ) Link to comment
LoOs Posted August 15, 2015 Share Posted August 15, 2015 (edited) Edit # local x, y = guiGetScreenSize() local rx, ry = (x/1400), (y/900) function createDx ( ) dxDrawImage(rx*398, ry*410, rx*300, ry*300, 'images/up.png') end bindKey("F10","down",function () if removeEventHandler("onClientRender",root,createDx) then removeEventHandler("onClientRender",root,createDx) showCursor ( false ) else addEventHandler("onClientRender",root,createDx) showCursor ( true ) end end Edited August 16, 2015 by Guest Link to comment
t3wz Posted August 16, 2015 Share Posted August 16, 2015 Edit # local x, y = guiGetScreenSize() local rx, ry = (x/1400), (y/900) function createDx ( ) dxDrawImage(rx*398, ry*410, rx*300, ry*300, 'images/up.png') end bindKey("F10","down",function () if removeEventHandler("onClientRender",root,createDx) removeEventHandler("onClientRender",root,createDx) showCursor ( false ) else addEventHandler("onClientRender",root,createDx) showCursor ( true ) end end lines 9~10, you remove the event and then remove it again, what? (also you forget the then). local x, y = guiGetScreenSize() local rx, ry = (x/1400), (y/900) local rendering function createDx ( ) dxDrawImage(rx*398, ry*410, rx*300, ry*300, 'images/up.png') end bindKey("F10","down",function () if rendering then removeEventHandler("onClientRender",root,createDx) showCursor ( false ) else addEventHandler("onClientRender",root,createDx) showCursor ( true ) end rendering = not rendering end Link to comment
LoOs Posted August 16, 2015 Share Posted August 16, 2015 Edit # local x, y = guiGetScreenSize() local rx, ry = (x/1400), (y/900) function createDx ( ) dxDrawImage(rx*398, ry*410, rx*300, ry*300, 'images/up.png') end bindKey("F10","down",function () if removeEventHandler("onClientRender",root,createDx) removeEventHandler("onClientRender",root,createDx) showCursor ( false ) else addEventHandler("onClientRender",root,createDx) showCursor ( true ) end end lines 9~10, you remove the event and then remove it again, what? (also you forget the then). local x, y = guiGetScreenSize() local rx, ry = (x/1400), (y/900) local rendering function createDx ( ) dxDrawImage(rx*398, ry*410, rx*300, ry*300, 'images/up.png') end bindKey("F10","down",function () if rendering then removeEventHandler("onClientRender",root,createDx) showCursor ( false ) else addEventHandler("onClientRender",root,createDx) showCursor ( true ) end rendering = not rendering end It did not change anything , This style of programming in my own way in the Crown programming , I forgot 'then' only , Link to comment
boban88 Posted August 16, 2015 Author Share Posted August 16, 2015 stiil nothing but now cursor dont show too Link to comment
t3wz Posted August 16, 2015 Share Posted August 16, 2015 stiil nothing but now cursor dont show too local x, y = guiGetScreenSize() local rx, ry = (x/1400), (y/900) local rendering function createDx ( ) dxDrawImage(rx*398, ry*410, rx*300, ry*300, 'up.png') end bindKey("F10","down",function () if rendering then removeEventHandler("onClientRender",root,createDx) showCursor ( false ) else addEventHandler("onClientRender",root,createDx) showCursor ( true ) end rendering = not rendering end ) i just forgot an ) ... Link to comment
boban88 Posted August 26, 2015 Author Share Posted August 26, 2015 sorry iwas on holidays now work perffect thank you 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