BigBrother Posted September 22, 2013 Share Posted September 22, 2013 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, Link to comment
manve1 Posted September 22, 2013 Share Posted September 22, 2013 getDistanceBetweenPoints3D Link to comment
BigBrother Posted September 22, 2013 Author Share Posted September 22, 2013 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 ... Link to comment
TAPL Posted September 22, 2013 Share Posted September 22, 2013 onPlayerChat cancelEvent getElementsByType getElementPosition getDistanceBetweenPoints3D outputChatBox Link to comment
manawydan Posted September 23, 2013 Share Posted September 23, 2013 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) 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