zocken212 Posted October 29, 2013 Share Posted October 29, 2013 Hey all I want to make a firefighter job but I have a problem. Since createFire returns no element I used particle_objects to make a fire object. Now when I'm aiming on it it always says "Error: Expected element at argument 1, got boolean".. (I created the fires before in another part) addEventHandler("onPlayerTarget",getRootElement(), function (hitElement) if getElementType(hitElement) == "object" then -- Error: Expected element at argument 1, got boolean if getElementData(hitElement,"fire") == true then outputChatBox("This is a fire") end end end) Where is my problem?? Link to comment
csiguusz Posted October 29, 2013 Share Posted October 29, 2013 This can happen, if the played dindn't target anything wich can be detected by this event. To avoid the error do one mor check: if isElement ( hitElement ) and getElementType(hitElement) == "object" then Link to comment
zocken212 Posted October 29, 2013 Author Share Posted October 29, 2013 Ok thanks, the error doesn't appear anymore. Now my next problem is that the outputChatBox does not work ._. (No error or else, only there is no chatbox output) Edit: Working now (Didn't aim with a weapon on it) Link to comment
csiguusz Posted October 29, 2013 Share Posted October 29, 2013 This is likely because you are not targeting anything with the type 'object'. Edit: great! 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