Jump to content

Got Nil.


NodZen

Recommended Posts

Posted

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) 

Posted

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.

Posted
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

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