Jump to content

help with function


Machine

Recommended Posts

whats wrong in this code

local marker = createMarker(-2596.625, 579.358, 15.626, 'cylinder', 2.0, 255, 0, 0, 150) 
addEventHandler("onClientMarkerHit",root, 
    function(h) 
        if h == localPlayer and source == marker then 
            addEventHandler("onClientRender",root,drawText) 
                setElementFrozen ( player, true ) 
        end 
    end 
) 
  
function drawText() 
    dxDrawText("Prees F To Exit!",423.0,601.0,623.0,637.0,tocolor(255,255,255,255),2.0,"clear","left","top",false,false,false) 
  
  
end 
  
addEventHandler("onClientMarkerLeave",root, 
    function(h) 
        if h == localPlayer and source == marker then 
            removeEventHandler("onClientRender", root,drawText) 
                setElementFrozen ( player, false ) 
        end 
    end 
) 

Link to comment
Guest Guest4401
local marker = createMarker(-2596.625, 579.358, 15.626, 'cylinder', 2.0, 255, 0, 0, 150) 
addEventHandler("onClientMarkerHit",root, 
    function(h) 
        if h == localPlayer and source == marker then 
            addEventHandler("onClientRender",root,drawText) 
                setElementFrozen ( h, true ) 
        end 
    end 
) 
  
function drawText() 
    dxDrawText("Prees F To Exit!",423.0,601.0,623.0,637.0,tocolor(255,255,255,255),2.0,"clear","left","top",false,false,false) 
  
  
end 
  
addEventHandler("onClientMarkerLeave",root, 
    function(h) 
        if h == localPlayer and source == marker then 
            removeEventHandler("onClientRender", root,drawText) 
                setElementFrozen ( h, false ) 
        end 
    end 
) 

Link to comment
local marker = createMarker(-2596.625, 579.358, 14, 'cylinder', 2.0, 255, 0, 0, 150) 
addEventHandler("onClientMarkerHit",root, 
    function(h) 
        if h == localPlayer and source == marker then 
            addEventHandler("onClientRender",root,drawText) 
                setElementFrozen ( h, true ) 
  
        end 
    end 
) 
  
function drawText() 
    dxDrawText("Prees F To Exit!",423.0,601.0,623.0,637.0,tocolor(255,255,255,255),2.0,"clear","left","top",false,false,false) 
  
  
end 
  
addEventHandler("onClientMarkerLeave",root, 
    function(h) 
        if h == localPlayer and source == marker then 
            removeEventHandler("onClientRender", root,drawText) 
                setElementFrozen ( h, false ) 
        bindKey ( "f", "down", h ) 
        end 
    end 
) 

i just added bindkey so when you prees f quit from marker so forzen must be false and text disapear

but didnt work :shock:

Link to comment

You're now binding key to a non-existing function/command "h". I just don't get you, what are you trying to do?

EDIT:

That maybe?

    local marker = createMarker(-2596.625, 579.358, 14, 'cylinder', 2.0, 255, 0, 0, 150) 
    addEventHandler("onClientMarkerHit",root, 
        function(h) 
            if h == localPlayer and source == marker then 
                addEventHandler("onClientRender",root,drawText) 
                    setElementFrozen ( h, true ) 
      
            end 
        end 
    ) 
      
    function drawText() 
        dxDrawText("Prees F To Exit!",423.0,601.0,623.0,637.0,tocolor(255,255,255,255),2.0,"clear","left","top",false,false,false) 
      
      
    end 
      
    function h() 
              removeEventHandler("onClientRender", root,drawText) 
              setElementFrozen ( localPlayer, false ) 
    end 
    bindKey ( "f", "down", h ) 

Link to comment
its exactly what i want but is it possible to make player get gun when he hit marker and when he out from it(preesed f) hes gun taken

i think i must use

giveWeapon ( thePlayer, 31, 200 )

takeWeapon ( thePlayer, 31, 5 )

but i tired didnt work!

i guess you use it client side, and these functions is server side.

Link to comment

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...