Jump to content

/do script


overlocus

Recommended Posts

addCommandHandler( "do",
	function( p, cmd, ... )
		local x, y, z = getElementPosition(p)
		local msg = table.concat( {...}, " " )
		if msg and #msg > 5 then
			local plyrs = getElementsByType('player')
			for i=1, #plyrs do 
				local px, py, pz = getElementPosition( plyrs[i] )
				if getDistanceBetweenPoints3D( x, y, z, px, py, pz ) < 5 then
					outputChatBox( "* "..msg.." ("..getPlayerName(p)..")", plyrs[i], 255, 255, 0 )
				end
			end
		else
			outputChatBox( "/"..cmd.." [message, min 5 characters]", p, 255, 255, 255 )
		end
	end
)

 

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...