jortjuh Posted March 31, 2011 Share Posted March 31, 2011 (edited) hello, i want to try to use moving objects in maps, that works for me but i want to use it when the player is in a certain area. there for i use: elementColShapeHit. i'm currently using a test script i got from MTA wiki. when i use this in free roam resource it works. but when i'm using the script in my race resource(so i'm using cars) it stops working, but MTA wiki says it should work with both(player and cars) this is the code i got from MTA wiki: local gate_test = createColCircle ( 2482, -1701, 20 ) function elementColShapeHit( colShapeHit ) if colShapeHit == gate_test then -- if element entered the created colshape outputChatBox( getElementType( source ) .. " entered the colCircle!" ) -- print the type of the element to chatbox end end addEventHandler( "onElementColShapeHit", getRootElement(), elementColShapeHit ) -- add a handler function for the event Edited April 4, 2011 by Guest Link to comment
jortjuh Posted April 2, 2011 Author Share Posted April 2, 2011 can some one help me please? Link to comment
GodFather Posted April 3, 2011 Share Posted April 3, 2011 Try to ask here. viewforum.php?f=91 Link to comment
jortjuh Posted April 4, 2011 Author Share Posted April 4, 2011 ok thanks i will do that. Link to comment
Moderators Citizen Posted April 4, 2011 Moderators Share Posted April 4, 2011 Maybe you forgot to load you script in the meta.xml ? And why a colCircle ? because if a plane flies over the circle, it will activate the gate so I you advice to use createColSphere Link to comment
jortjuh Posted April 4, 2011 Author Share Posted April 4, 2011 Maybe you forgot to load you script in the meta.xml ?And why a colCircle ? because if a plane flies over the circle, it will activate the gate so I you advice to use createColSphere i added it in my meta.xml but i it really doesn't work. it doesn't give any errors. and when i use it in a freeroam and i walk through it, it works but when i use it in my race resource it doesnt work. maybe it isn't compatible with race resource? Link to comment
Moderators Citizen Posted April 4, 2011 Moderators Share Posted April 4, 2011 Try with onColShapeHit: function elementColShapeHit( theElement ) if source == gate_test then -- if element entered the created colshape outputChatBox( getElementType( theElement ) .. " entered the colCircle!" ) end end addEventHandler( "onColShapeHit", getRootElement(), elementColShapeHit ) Link to comment
jortjuh Posted April 5, 2011 Author Share Posted April 5, 2011 it is not working...... i don't know whats wrong with it Link to comment
Moderators Citizen Posted April 6, 2011 Moderators Share Posted April 6, 2011 What's the problem ? There no errors ? I think there is a conflict with your GM. Try this: local gate_test = createColCircle ( 2482, -1701, 20 ) function elementColShapeHitTheColCircle( theElement ) outputChatBox( getElementType( theElement ).. " entered the colCircle!" ) end addEventHandler( "onColShapeHit", gate_test, elementColShapeHitTheColCircle ) EDIT: I tested this code and it works perfectly ! Link to comment
jortjuh Posted April 8, 2011 Author Share Posted April 8, 2011 What's the problem ? There no errors ? I think there is a conflict with your GM.Try this: local gate_test = createColCircle ( 2482, -1701, 20 ) function elementColShapeHitTheColCircle( theElement ) outputChatBox( getElementType( theElement ).. " entered the colCircle!" ) end addEventHandler( "onColShapeHit", gate_test, elementColShapeHitTheColCircle ) EDIT: I tested this code and it works perfectly ! it works! thanks for helping all! Link to comment
Moderators Citizen Posted April 9, 2011 Moderators Share Posted April 9, 2011 No problem 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