eXecuteR Posted November 13, 2013 Share Posted November 13, 2013 (edited) isElementWithinMarker function(player) local marker3 if player ~= localPlayer then return end if isElementWithinMarker (player,marker2) then marker3 = createMarker ( 3013.8999023438, -1653, 172.30000305176, "corona", 2) end return marker3 end) addEventHandler("onClientMarkerHit", root, function(player) if player ~= localPlayer then return end if isElementWithinMarker(player,marker3) then setElementCollisionsEnabled(box1,false) end<<<<< if isElementWithinMarker (player,marker3) then setElementCollisionsEnabled(box2,false) end<<<<< end) Edited November 13, 2013 by Guest Link to comment
tosfera Posted November 13, 2013 Share Posted November 13, 2013 You should add [lua] tag's around your post, plus post your error and the first eventHandler from the first function too. Link to comment
tosfera Posted November 13, 2013 Share Posted November 13, 2013 What's box2? The script is quite messed up and bad written, sorry to say that. Link to comment
eXecuteR Posted November 13, 2013 Author Share Posted November 13, 2013 [lua] isElementWithinMarker function() marker2 = createMarker(3039.5, -1653.1999511719, 181.69999694824, "corona", 2) box1 = createObject(9131,3040.8000488281, -1653, 182.69999694824, 50.250061035156 ,90.000030517578, 89.999969482422) box2= createObject(9131,3040.3879394531, -1653, 183.19999694824, 50.250061035156 ,90 , 89.994506835938) end) function(player) local marker3 if player ~= localPlayer then return end if isElementWithinMarker (player,marker2) then marker3 = createMarker ( 3013.8999023438, -1653, 172.30000305176, "corona", 2) end return marker3 end) addEventHandler("onClientMarkerHit", root, function(player) if player ~= localPlayer then return end if isElementWithinMarker(player,marker3) then setElementCollisionsEnabled(box1,false) end<<<<< if isElementWithinMarker (player,marker3) then setElementCollisionsEnabled(box2,false) end<<<<< end) [lua] Link to comment
tosfera Posted November 13, 2013 Share Posted November 13, 2013 try something like this; local marker1, marker2, marker3, box1, box2; addEventHandler ( "", root, function() marker2 = createMarker(3039.5, -1653.1999511719, 181.69999694824, "corona", 2); box1 = createObject(9131,3040.8000488281, -1653, 182.69999694824, 50.250061035156 ,90.000030517578, 89.999969482422); box2= createObject(9131,3040.3879394531, -1653, 183.19999694824, 50.250061035156 ,90 , 89.994506835938); end ); addEventHandler ( "onClientMarkerHit", root, function( thePlayer ) if ( thePlayer ~= localPlayer ) then return end if ( isElementWithinMarker ( thePlayer, marker2 ) ) then marker3 = createMarker ( 3013.8999023438, -1653, 172.30000305176, "corona", 2); end end ); addEventHandler("onClientMarkerHit", marker3, function( thePlayer ) if ( thePlayer ~= localPlayer ) then return end if ( isElementWithinMarker( thePlayer, marker3 ) ) then setElementCollisionsEnabled( box1, false ); end if ( isElementWithinMarker ( thePlayer, marker3 ) ) then setElementCollisionsEnabled( box2, false ); end end ); Link to comment
eXecuteR Posted November 13, 2013 Author Share Posted November 13, 2013 addEventHandler ("onclientMarkerhit, marker3, bad argument @ 'addEventHandler' [Expected element at argument 2 ,got nil] Link to comment
eXecuteR Posted November 13, 2013 Author Share Posted November 13, 2013 loool its worked but still have the same error bad argument 'isElementWhithinMarker' if i changed ((addEventHandler ("onclientMarkerhit, marker3,)) to addEventHandler ("onclientMarkerhit, root, so whats the problem then Link to comment
tosfera Posted November 13, 2013 Share Posted November 13, 2013 Root is defined as getRootElement(), if you're using root you've to check is source ( theMaker ) is the marker you wanted. Changing root to the name of your marker allows you to skip the if-statement to see if it is your marker. Link to comment
eXecuteR Posted November 13, 2013 Author Share Posted November 13, 2013 ok i did used marker3 as you wrote before and got that error... is there is any other way to do it? Link to comment
Castillo Posted November 13, 2013 Share Posted November 13, 2013 That's because the markers don't exist when you add the event handler. 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