Tiring Script And Scream Code

Started by SonmezAltug, Feb 07, 2020, 12:27 PM

Previous topic - Next topic

SonmezAltug

Hi my friends,
I am making a basic roleplay server so i am trying to make it realistic. First we now players can sprint infinite so i want them tired after 10 seconds of running. But i need a syntax for it. And the second thing if someone sends a message, that message should be seen only 15 meters from nearby players. So he will type "/scream Police, put your hands up!". This message will only be shown to players who are 15 meters in diameter. But I don't know something like "radius trigger". I am amateur. Thanks from now.

habi

hey brother, radius trigger is easy. use DistanceFromPoint( x1, y1, x2, y2 ) function.
if(cmd=="scream")
{
local i =0;
local nearplr;
local distance;
for( i=0;i<100;i++)
{
nearplr=FindPlayer(i);
if(nearplr)
{
distance = DistanceFromPoint( nearplr.Pos.x, nearplr.Pos.y, player.Pos.x, player.Pos.y );
if( distance < 15 )
{
MessagePlayer(player.Name+" screams: "+text, nearplr);
}
}
}
}