Abohak Posted June 2, 2016 Share Posted June 2, 2016 bindKey("aim_weapon", "both",function(key, state) local weapon = getPedWeapon(getLocalPlayer()) if weapon ~= 0 and weapon ~=1 and weapon ~= 34 then if state == "down" then addEventHandler("onClientRender", root, drawCrosshair) else removeEventHandler("onClientRender", root, drawCrosshair) end end end ) [ [18:30:03] Starting c_dayz [ [18:30:05] WARNING: c_dayz/cross_pod.lua:11: Bad argument @ 'bindKey' [Expected [ player at argument 1, got string 'aim_weapon'] [ [18:30:05] Start up of resource c_dayz cancelled by script [ [18:30:05] Stopping c_dayz [ [18:30:05] start: Resource 'c_dayz' start was requested (Start up of resource ca [ ncelled by script) What's the problem here? Link to comment
Gravestone Posted June 6, 2016 Share Posted June 6, 2016 The first argument of bindKey is the element to bind the key of. Try this: bindKey(localPlayer, "aim_weapon", "both", function(key, state) local weapon = getPedWeapon(localPlayer) if weapon ~= 0 and weapon ~=1 and weapon ~= 34 then if state == "down" then addEventHandler("onClientRender", root, drawCrosshair) else removeEventHandler("onClientRender", root, drawCrosshair) end end end ) Link to comment
Gravestone Posted June 8, 2016 Share Posted June 8, 2016 Can you provide us with a screenshot of the debug? Link to comment
ViRuZGamiing Posted June 8, 2016 Share Posted June 8, 2016 The first argument of bindKey is the element to bind the key of. Try this: bindKey(localPlayer, "aim_weapon", "both", function(key, state) local weapon = getPedWeapon(localPlayer) if weapon ~= 0 and weapon ~=1 and weapon ~= 34 then if state == "down" then addEventHandler("onClientRender", root, drawCrosshair) else removeEventHandler("onClientRender", root, drawCrosshair) end end end ) You're first argument is localPlayer would let me think this is client side but client side bindKey's first argument is not a player element since client side's player argument always equals localPlayer. bool bindKey ( string key, string keyState, function handlerFunction, [ var arguments, ... ] ) Link to comment
Gravestone Posted June 8, 2016 Share Posted June 8, 2016 Oh, then what should it be like? 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