Sign in to follow this  

1 player max inside a marker

Recommended Posts

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.

Share this post

Link to post

Yous can use the marker's elementData for it. Like, when player z enter to marker x, the player set the marker with


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



Edited by Awang

Share this post

Link to post
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== Elements [ 1 ] ) then 
          setElementHealth ( v , 0 ) 

Test this .

Share this post

Link to post

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.