killingyasoon Posted November 19, 2018 Share Posted November 19, 2018 how to set a limit for a marker like the marker accepts only 1 player inside it, lets make it a bit clear, we got marker x and player z and player y, player z enters the marker x and the marker works, player y enters, the marker doesnt work for him. Link to comment
Awang Posted November 19, 2018 Share Posted November 19, 2018 (edited) Yous can use the marker's elementData for it. Like, when player z enter to marker x, the player set the marker with setElementData(theMarker,"marker.player",localPlayer) Now, whenever other player hit the marker, you can look for the elemenet data. If it is a player, you do nothing, otherwise you set the ElementData. When player z leave the marker, then you set the ElementData to nil, so now other player can acces it. But you should think about, what if the player quit from the server, while it is the "root" of the marker, or there is a teleport by other player... Maybe you can check it double, like with getElementColShape() and isElementWithinColShape() or getElementsWithinColShape() Edited November 19, 2018 by Awang Link to comment
^iiEcoo'x_) Posted November 19, 2018 Share Posted November 19, 2018 local Marker = createMarker ( x , y , z , 'cylinder' , 3 , 255 , 255 , 0 , 255 ) addEventHandler ( 'onMarkerHit' , root , function ( Player ) local MarkerColShape = getElementColShape ( source ) local Elements = getElementsWithinColShape ( MarkerColShape ) for _ , v in ipairs ( Elements ) do if ( getElementType ( v ) == 'player' ) then if ( not v == Elements [ 1 ] ) then setElementHealth ( v , 0 ) end end end end ) Test this . Link to comment
killingyasoon Posted November 20, 2018 Author Share Posted November 20, 2018 Thank you guys. 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