isa_Khamdan Posted August 8, 2013 Share Posted August 8, 2013 Hello , I need to edit this GUI so when the player leave the marker in any ways ( Warp , Death or anything ) the GUI will be hidden This is the code --------------------- local Marker = createMarker ( 296, -37, 999.5, "cylinder", 2, 255, 255, 0, 150 ) setElementInterior( Marker, 1, 296, -37, 999.5 ) addEventHandler('onClientMarkerHit', Marker, function ( hitPlayer ) if ( hitPlayer == localPlayer ) then show() showCursor( true ) end end ) createBlip ( 1367, -1279, 13 , 6 ) Link to comment
manve1 Posted August 8, 2013 Share Posted August 8, 2013 --Functions guiSetVisible showCursor --Events onClientMarkerLeave Link to comment
TrapLord Studios™ Posted August 8, 2013 Share Posted August 8, 2013 addEventHandler( "onMarkerLeave", Marker, markerLeave ) Link to comment
isa_Khamdan Posted August 8, 2013 Author Share Posted August 8, 2013 I tested this but it didn't work sorry I am still new with Lua coding local Marker = createMarker ( 296, -37, 999.5, "cylinder", 2, 255, 255, 0, 150 ) setElementInterior( Marker, 1, 296, -37, 999.5 ) addEventHandler('onClientMarkerHit', Marker, function ( hitPlayer ) if ( hitPlayer == localPlayer ) then show() showCursor( true ) end end ) function markerLeave ( leavingPlayer, matchingDimension, Marker, if ( localPlayer ) then hide() showCursor( false ) end addEventHandler ( "onClientMarkerLeave", getRootElement(), markerLeave ) createBlip ( 1367, -1279, 13 , 6 ) Link to comment
manve1 Posted August 8, 2013 Share Posted August 8, 2013 addEventHandler( "onMarkerLeave", Marker, markerLeave ) That won't work, and first of all you should of looked at what type of events he was already using, then you would of maybe noticed it was client sided events. After all, where did you define "show()" and "hide()"? Link to comment
isa_Khamdan Posted August 8, 2013 Author Share Posted August 8, 2013 (edited) Deleted Edited August 8, 2013 by Guest Link to comment
manve1 Posted August 8, 2013 Share Posted August 8, 2013 function show() isn't made correctly so the code would fail right away Link to comment
isa_Khamdan Posted August 8, 2013 Author Share Posted August 8, 2013 Anyone can help me to fix it? Link to comment
golanu21 Posted August 8, 2013 Share Posted August 8, 2013 i make for you an script when markerhit, to show you a text "PRESS 'F' TO OPEN SHOP"... local Marker = createMarker ( 296, -37, 999.5, "cylinder", 2, 255, 255, 0, 150 ) setElementInterior( Marker, 1, 296, -37, 999.5 ) function dxText2 ( ) dxDrawText("Press \"F\" for open shop.", 756, 596, 1161, 630, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, true, false, false) dxDrawText("Press \"F\" for open shop.", 756, 594, 1161, 628, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, true, false, false) dxDrawText("Press \"F\" for open shop.", 754, 596, 1159, 630, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, true, false, false) dxDrawText("Press \"F\" for open shop.", 754, 594, 1159, 628, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, true, false, false) dxDrawText("Press \"F\" for open shop.", 755, 595, 1160, 629, tocolor(49, 250, 2, 255), 1.00, "bankgothic", "center", "center", false, false, true, false, false) end addEventHandler ( "onClientMarkerHit", Marker, function ( hitPlayer, matchingDimension ) if hitPlayer == localPlayer then addEventHandler ( "onClientRender", root, dxText2) function ss () show() showCursor( true ) end bindKey("f", "down", ss) end end ) addEventHandler ( "onClientMarkerLeave", Marker, function ( leftPlayer, matchingDimension ) removeEventHandler ( "onClientRender", root, dxText2) unbindKey("f", "down", ss) end ) for me work perfectly Link to comment
isa_Khamdan Posted August 8, 2013 Author Share Posted August 8, 2013 i make for you an script when markerhit, to show you a text "PRESS 'F' TO OPEN SHOP"... local Marker = createMarker ( 296, -37, 999.5, "cylinder", 2, 255, 255, 0, 150 ) setElementInterior( Marker, 1, 296, -37, 999.5 ) function dxText2 ( ) dxDrawText("Press \"F\" for open shop.", 756, 596, 1161, 630, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, true, false, false) dxDrawText("Press \"F\" for open shop.", 756, 594, 1161, 628, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, true, false, false) dxDrawText("Press \"F\" for open shop.", 754, 596, 1159, 630, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, true, false, false) dxDrawText("Press \"F\" for open shop.", 754, 594, 1159, 628, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, true, false, false) dxDrawText("Press \"F\" for open shop.", 755, 595, 1160, 629, tocolor(49, 250, 2, 255), 1.00, "bankgothic", "center", "center", false, false, true, false, false) end addEventHandler ( "onClientMarkerHit", Marker, function ( hitPlayer, matchingDimension ) if hitPlayer == localPlayer then addEventHandler ( "onClientRender", root, dxText2) function ss () show() showCursor( true ) end bindKey("f", "down", ss) end end ) addEventHandler ( "onClientMarkerLeave", Marker, function ( leftPlayer, matchingDimension ) removeEventHandler ( "onClientRender", root, dxText2) unbindKey("f", "down", ss) end ) for me work perfectly your code works fine and it's a great idea but the problem is that some people can open the gui outside the war room I made so I want the gui be hidden when they leave the marker. Edit : your code will only hide the text and the bind key but the gui will still be visible for them when they leave the marker using warp or by death Link to comment
isa_Khamdan Posted August 8, 2013 Author Share Posted August 8, 2013 Never mind I fixed it thanks a lot for your help Just one last thing how can I make the text in the center of the screen in all resolutions? function dxText2 ( ) dxDrawText("Press \"F\" for open shop.", 756, 596, 1161, 630, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, true, false, false) dxDrawText("Press \"F\" for open shop.", 756, 594, 1161, 628, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, true, false, false) dxDrawText("Press \"F\" for open shop.", 754, 596, 1159, 630, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, true, false, false) dxDrawText("Press \"F\" for open shop.", 754, 594, 1159, 628, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, true, false, false) dxDrawText("Press \"F\" for open shop.", 755, 595, 1160, 629, tocolor(49, 250, 2, 255), 1.00, "bankgothic", "center", "center", false, false, true, false, false) end Link to comment
isa_Khamdan Posted August 9, 2013 Author Share Posted August 9, 2013 Never Mind I fixed it 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