Jump to content

[HELP] onClientKey isn't working


LabiVila

Recommended Posts

local x,y = guiGetScreenSize () 
  
function looting () 
    for k,v in pairs (getElementsByType ("object")) do 
        if getElementModel (v) == 2991 then 
            local px, py, pz = getElementPosition (localPlayer) 
            local ox, oy, oz = getElementPosition (v) 
            dis = getDistanceBetweenPoints3D (px, py, pz, ox, oy, oz) 
            if dis < 3 then 
                dxDrawText ("You can loot the item, hold R.", x/3, y/3, x, y, tocolor (255, 255, 255, 255)) 
                addEventHandler ("onClientKey", root, 
                    function (button, release) 
                        if button == "R" and release then    
                            outputChatBox ("R has been typed, ...") 
                        end 
                    end 
                ) 
            end 
        end 
    end 
end 
addEventHandler ("onClientRender", root, looting) 
  

The message "R has been typed, ..." isn't working, I'd appreciate some help.

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