Fabioxps Posted August 14, 2013 Posted August 14, 2013 I can not find what's wrong local Marker = createMarker ( 2498.1000976563, -1683.5999755859, 13.39999961853, "cylinder", 5, 255, 255, 0, 0 ) --setElementInterior( Marker, 0, 296, -37, 999.5 ) addEventHandler ( "onClientMarkerHit", Marker, function ( hitPlayer, matchingDimension ) if hitPlayer == localPlayer then function () showDx(); else hideDx(); end bindKey("f1", "down", ) end end ) addEventHandler ( "onClientMarkerLeave", Marker, function ( leftPlayer, matchingDimension ) unbindKey("f1", "down", ) end )
tosfera Posted August 14, 2013 Posted August 14, 2013 Mate, your code is a mess. You created a function in a function. Thats like, impossible... try this; local Marker = createMarker ( 2498.1000976563, -1683.5999755859, 13.39999961853, "cylinder", 5, 255, 255, 0, 255 ) addEventHandler ( "onClientMarkerHit", Marker, function ( hitPlayer, matchingDimension ) if ( hitPlayer == localPlayer ) then bindKey("f1", "down", showDx) end end ) function showDx() -- @todo end function hideDx() -- @todo end addEventHandler ( "onClientMarkerLeave", Marker, function ( leftPlayer, matchingDimension ) unbindKey("f1", "down", ) end )
tosfera Posted August 14, 2013 Posted August 14, 2013 This is impossible to do; addEventHandler ( "onClientMarkerHit", Marker, function ( hitPlayer, matchingDimension ) if hitPlayer == localPlayer then function () showDx(); else hideDx(); end
bandi94 Posted August 14, 2013 Posted August 14, 2013 actually it's possible to create a function inside another function but a bit difrent way function start() --blabla DxRender = function() ----blabla end addEventHandler("onClientRender",root, DxRender) end addCommandHandler(....,start)
tosfera Posted August 14, 2013 Posted August 14, 2013 actually it's possible to create a function inside another function but a bit difrent way function start() --blabla DxRender = function() ----blabla end addEventHandler("onClientRender",root, DxRender) end addCommandHandler(....,start) Noway, only Java supports that. right?
Moderators IIYAMA Posted August 14, 2013 Moderators Posted August 14, 2013 I am using it sometimes, but a local function is always faster because you don't have to recreate another function. Most of the time with fast timers or things that have to be done without interrupt other things that require all the data inside. I love lua, so many possibility's and so many code styles
tosfera Posted August 14, 2013 Posted August 14, 2013 I am using it sometimes, but a local function is always faster because you don't have to recreate another function.Most of the time with fast timers or things that have to be done without interrupt other things that require all the data inside. I love lua, so many possibility's and so many code styles so many possibility's.... so many possibility's.... so many possibility's....
Moderators IIYAMA Posted August 14, 2013 Moderators Posted August 14, 2013 it seems you totally agree with me . . . . btw I hate p-p-paaaaiint! I almost can't write it down.
Fabioxps Posted August 15, 2013 Author Posted August 15, 2013 press F opens my guide when tightening over again does not close. local function showLobbys() guiSetVisible(lobbyButHunter,true); end local function hideLobbys() guiSetVisible(lobbyButHunter,false); end local Markerd = createMarker ( -3617.8000488281, -713.5, 7.9000000953674, "cylinder", 5, 255, 255, 0, 0 ) addEventHandler ( "onClientMarkerHit", Markerd, function ( hitPlayer, matchingDimension ) if hitPlayer == localPlayer then function ssd () showLobbys() end bindKey("f", "down", ssd) end end ) addEventHandler ( "onClientMarkerLeave", Markerd, function ( leftPlayer, matchingDimension ) unbindKey("f", "down", ssd) end ) hideLobbys();
tosfera Posted August 15, 2013 Posted August 15, 2013 Try this code; local Markerd = createMarker ( -3617.8000488281, -713.5, 7.9000000953674, "cylinder", 5, 255, 255, 0, 0 ) addEventHandler ( "onClientMarkerHit", Markerd, function ( hitPlayer, matchingDimension ) if ( hitPlayer == localPlayer ) then bindKey("f", "down", toggleLobbys) end end ); local function toggleLobbys() if ( guiGetVisible ( lobbyButHunter ) ) then guiSetVisible( lobbyButHunter, false ); else guiSetVisible( lobbyButHunter, true ); end end addEventHandler ( "onClientMarkerLeave", Markerd, function ( leftPlayer, matchingDimension ) unbindKey( "f", "down", toggleLobbys ) end );
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