NodZen Posted September 14, 2013 Posted September 14, 2013 Hi guys, i've this problem: Bad argument @ 'addEventHandler' [Expected element at argument 2, got nil] Code here: function Tog (thePlayer,matchingDimension) Are = createColRectangle ( 342.54418945313, -2093.8819476563, 65, 70 ) Radar = createRadarArea ( 342.54418945313, -2093.8819476563, 65, 500, 255, 200, 0, 150 ) if (getElementType(thePlayer) == "player") then toggleControl(thePlayer,"fire",false) toggleControl(thePlayer,"next_weapon ",false) toggleControl(thePlayer,"previous_weapon ",false) toggleControl(thePlayer,"sprint",false) end end addEventHandler ( "onColShapeHit", Are, Tog)
DNL291 Posted September 14, 2013 Posted September 14, 2013 Because the rectangle will be created only after Tog function is called. And you're adding an event handler to the colshape element before creating it.
NodZen Posted September 14, 2013 Author Posted September 14, 2013 Because the rectangle will be created only after Tog function is called.And you're adding an event handler to the colshape element before creating it. Thank you. Works
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