Jump to content

1 player max inside a marker


Recommended Posts

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
Link to comment
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 .

Link to comment

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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...