Bean666 Posted January 19, 2015 Share Posted January 19, 2015 hi , i created my transport system via DX GUI , Works fine with the commands. but buttons.... when i click the hospital Button , nothing happens even i had it setelementposition , any help here? function draw() base = dxDrawRectangle(393, 194, 478, 424, tocolor(29, 127, 29, 180), false) dxDrawText("Welcome To Los Santos Airport", 405, 203, 752, 233, tocolor(255, 255, 255, 255), 1.00, "pricedown", "left", "top", false, false, false, false, false) dxDrawText("LSPD", 531, 255, 176, 74, tocolor(255, 255, 255, 255), 1.00, "pricedown", "left", "top", false, false, false, false, false) dxDrawText("Airport", 531, 361, 176, 74, tocolor(255, 255, 255, 255), 1.00, "pricedown", "left", "top", false, false, false, false, false) dxDrawText("Hospital", 531, 463, 176, 74, tocolor(255, 255, 255, 255), 1.00, "pricedown", "left", "top", false, false, false, false, false) lspd = guiCreateButton(531, 255, 176, 74, "Los Santos Police Dept.", false) guiSetAlpha(lspd, 0) guiSetVisible(lspd,false) airport = guiCreateButton(531, 361, 176, 74, "Airport", false) guiSetAlpha(airport, 0.00) guiSetVisible(airport,false) hospital = guiCreateButton(531, 463, 176, 74, "Hospital", false) guiSetAlpha(hospital, 0) guiSetVisible(hospital,false) guiSetVisible ( base, false ) showcursor (true) end addEventHandler("onClientGUIClick",hospital,function() if ( source == hospital) then guiSetVisible(base, false) showCursor(false) setElementPosition ( getLocalPlayer(), -1154.2412109375, -1000.203125, 129.21875 ) end end ) local drawingPanel = false; function startDrawing_CMD() if(drawingPanel == false) then addEventHandler("onClientPreRender", getRootElement(), draw); drawingPanel = true; showCursor(true) else removeEventHandler("onClientPreRender", getRootElement(), draw); drawingPanel = false; showCursor(false) end end addCommandHandler("teleport", startDrawing_CMD, false, false); Link to comment
Et-win Posted January 19, 2015 Share Posted January 19, 2015 If you throw function 'draw' onto a render, then you know it will create a button for every frame, and lagg will be huge and then your game will probably crash? Anyway: addEventHandler("onClientGUIClick",guiRoot,function() 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