Jump to content

Making a /me command


BigBrother

Recommended Posts

Posted

Hello guys,

I'd like to create a /me command, I know how to make it but I'm locked on a point ... How to limit the display distance ?

If I want to display the /me text in a range of 10 meters for exemple, how could I script it ?

Regards,

Posted

Thanks, but How could I use it ?

It's between two points, and not really a "region"

How to make a system like that :

Show the /me command only to the player in the region of a 10 meter radius ...

Posted

only example

  
function meCom (Mens,typ) 
 if typ == 1 then 
local PlayersP = getElementsByType("player")) 
for _,Pl in ipairs(PlayersP) do 
local x,y,z = getElementPosition(Pl) 
local x2,y2,z2 = getElementPosition(source) -- source of the event "onPlayerChat" 
local Distance = getDistanceBetweenPoints2D ( x,y, x2,y2 ) -- you can use getDistanceBetweenPoints3D if want 
 if (Distance <= 10) then 
 outputChatBox(Mens,Pl) 
 --else 
 --cancelEvent() 
 end 
  end 
    end 
end 
addEventHandler("onPlayerChat",getRootElement(),meCom) 

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