The online racing simulator
Creating a easy Copsystem
Hi guys/Programmers,

I need bit help at my copsystems ive done now all conditions and fines ect but i have a simple maybe easy problem

how i can "Chase" a other guy ?
i mean
if i type "!chase" that it "Chases" the player who is ca.200meters away from me

like if a players is in the 200meter area i can chase everybody in these 200meters like.
!chase
>Marco1 is chasing Scawen

an if no one is near 200meters to me
!chase
>No Player in Chase area.


i need only this code that it shows me this 2 usernames/lfswnames.
the other things i have allready

Best Regarts Marco1.
You need to store the X, Y and Z coordinates of each driver in the race, and when someone types !chase you will need to loop through them all and check how far away they are. The X, Y and Z coordinates are contained in the IS_MCI packet. In order to determine the distance between 2 points you can use some code like this:

double GetDistance(int aX, int aY, int aZ, int bX, int bY, int bZ)
{
int xDistance = bX - aX;
int yDistance = bY - aY;
int zDistance = bZ - aZ;

return Math.Sqrt(
(xDistance * xDistance )+
(yDistance * yDistance) +
(zDistance * zDistance));
}

The result of this method will need to be divided by 65536 in order to convert it into meters.

A quick search of the forum for "distance" presented these threads converting similar subjects.

http://www.lfsforum.net/showthread.php?t=51092
http://www.lfsforum.net/showthread.php?t=40901
http://www.lfsforum.net/showthread.php?t=35935
http://www.lfsforum.net/showthread.php?t=28077
Thanks Darktimes
and ive solved the other problem whit the 2 usernames just use it like in the !send cmd
Maths puhhh ^^

anyway Thank you

Greez Heiko
have a nice HOT sunday 36° .... :
so it is if i understand it right and codet it right in C#:

//DFO = DistanceFromOfficer
int DFO = ((int)Math.Sqrt(Math.Pow(MCI.Info[i].X - ([COLOR=Red]X[/COLOR] * 196608), 2) + Math.Pow(MCI.Info[i].Y - ([COLOR=Red]Y[/COLOR] * 196608), 2)) / 65536);

//distance in meters
if (DFO <= 200)
{
foreach (clsPlayers ChaseIdx in Players)
{
Message(YouUsername+" is chasing "ChaseIdx.Username);
}
}
else
{
Message("No Playout found within 200meters");
}

Now ive got an problem to:
But how to find out the Players X-Y coordinates
-
(MariusMM) DELETED by MariusMM
@ Mrius he means the x-y coordinates from a other player not from himself
so its then the code

MCI.Info[ChaseIdx].X
MCI.Info[ChaseIdx].Y

?

FGED GREDG RDFGDR GSFDG