Jump to content

?? BindKey


Fabioxps

Recommended Posts

Posted

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 
) 

Posted

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 
) 

Posted

This is impossible to do;

addEventHandler ( "onClientMarkerHit", Marker, 
    function ( hitPlayer, matchingDimension ) 
        if hitPlayer == localPlayer then 
  
        function () 
showDx(); 
  
else 
  
hideDx(); 
    end 

Posted

actually it's possible to create a function inside another function but a bit difrent way :D

function start() 
  
--blabla 
  
 DxRender = function() 
  
 ----blabla 
  
 end 
addEventHandler("onClientRender",root, DxRender) 
  
end 
  
addCommandHandler(....,start) 

Posted
actually it's possible to create a function inside another function but a bit difrent way :D
function start() 
  
--blabla 
  
 DxRender = function() 
  
 ----blabla 
  
 end 
addEventHandler("onClientRender",root, DxRender) 
  
end 
  
addCommandHandler(....,start) 

Noway, only Java supports that. right? :shock::shock::shock::shock:

  • Moderators
Posted

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 :P

Posted
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 :P

so many possibility's....

so many possibility's....

so many possibility's....

poker_face_kindledx.png

  • Moderators
Posted

it seems you totally agree with me . . . .

btw I hate p-p-paaaaiint! I almost can't write it down.

Posted

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(); 

Posted

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 
); 

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...