Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: Altay on Feb 07, 2020, 12:27 PM

Title: Tiring Script And Scream Code
Post by: Altay on Feb 07, 2020, 12:27 PM
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.
Title: Re: Tiring Script And Scream Code
Post by: habi on Feb 07, 2020, 01:33 PM
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);
}
}
}
}