Kenix Posted March 1, 2011 Share Posted March 1, 2011 script does not work local anomalstp1 = { {286.05, 1319.48, 3}, } function anomalys( thePlayer, matchingDimension ) local fX = anomalstp1[1] local fY = anomalstp1[2] local radius = anomalstp1[3] colShape[id] = createColCircle ( fX, fY, radius ) outputChatBox("1") end addEventHandler ( "onResourceStart", getRootElement(), anomalys ) function onAnomalyHit() outputChatBox("1") end addEventHandler ( "onColShapeHit", anomalstp1, onAnomalyHit ) Link to comment
Antibird Posted March 1, 2011 Share Posted March 1, 2011 What do you put as the second argument at line 22? A table? https://wiki.multitheftauto.com/wiki/AddEventHandler What's the "id" argument for colShape table at line 14? Is it really defined? Is the colShape a table? Link to comment
Kenix Posted March 1, 2011 Author Share Posted March 1, 2011 What do you put as the second argument at line 22? A table?https://wiki.multitheftauto.com/wiki/AddEventHandler What's the "id" argument for colShape table at line 14? Is it really defined? Is the colShape a table? thx function anomalys( thePlayer, matchingDimension ) WORKS Now how do I do that when you come into colShape table * anomalstp1 obtain a function outputChatBox? here I am done but not working local anomalstp1 = { {286.05, 1319.48, 3}, } function anomalys( thePlayer, matchingDimension ) local fX = anomalstp1[1] local fY = anomalstp1[2] local radius = anomalstp1[3] createColCircle ( fX, fY, radius ) outputChatBox("1") end addEventHandler ( "onResourceStart", getRootElement(), anomalys ) function onAnomalyHit() if anomalstp1 == true then outputChatBox("1") end addEventHandler ( "onColShapeHit", getRootElement(), onAnomalyHit ) 300 post Link to comment
Antibird Posted March 1, 2011 Share Posted March 1, 2011 Even while the colshape is created, you can't use it since you have no variable defined for it at line 15. Should be like: myColCircle = createColCircle ( fX, fY, radius ) Then, at line 21 you check if the colShape a player entered is myColCIrcle: replace line 21 with if source == myColCircle then Read https://wiki.multitheftauto.com/wiki/Event_system after and make sure to understand what does "source" mean, It's crucial. When you do it must be clear why using if anomalstp1 == true then is incorrect. Link to comment
Moderators Citizen Posted March 1, 2011 Moderators Share Posted March 1, 2011 Hi volk-us ( again ), local anomalstp1 = { {286.05, 1319.48, 3}, } function anomalys( thePlayer, matchingDimension ) local fX = anomalstp1[1] local fY = anomalstp1[2] local radius = anomalstp1[3] local colcircle = createColCircle ( fX, fY, radius ) setElementID( colcircle, "anomalstp1" ) outputChatBox("1") end addEventHandler ( "onResourceStart", getRootElement(), anomalys ) function onAnomalyHit() if anomalstp1 == true then outputChatBox("1") end end addEventHandler ( "onColShapeHit", getRootElement(), onAnomalyHit ) Replace by this: local anomalstp1 = { {286.05, 1319.48, 3}, } function onAnomalyHit( hitElement, matchingDimension ) --instructions end function anomalys( thePlayer, matchingDimension ) local fX = anomalstp1[1] local fY = anomalstp1[2] local radius = anomalstp1[3] local colcircle = createColCircle ( fX, fY, radius ) addEventHandler ( "onColShapeHit", colcircle, onAnomalyHit ) outputChatBox("1") end addEventHandler ( "onResourceStart", getRootElement(), anomalys ) It should works Link to comment
Kenix Posted March 1, 2011 Author Share Posted March 1, 2011 not work guys Citizen : bad argument 14 -15 line Antibird : bad argument 15 line Link to comment
Antibird Posted March 1, 2011 Share Posted March 1, 2011 local anomalstp1 = {286.05, 1319.48, 3} -- line1 Link to comment
Kenix Posted March 1, 2011 Author Share Posted March 1, 2011 local anomalstp1 = {286.05, 1319.48, 3} -- line1 it works great thanks brother 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