The online racing simulator
Police system idea
(3 posts, started )
Police system idea
Hello. I am creating Police system, but I stuck in it. I has been browsing in cruise mod source code's, but I found only simple police system, when around 250 meters, system found one player, which is closier to cop, and it will display one button with player. But I want create system, where I will get list of all players around 250 meters from cop, and on button click - start to chase player. I can create it with programming, but I didn't know principle of this system. I have tried with cicle for, while, but it didn't give benefit. So, can anyone tell this system principle, how it works?
P.S Sorry for my bad english.
Any ideas?
In IS_MCI packet processing checked "if player == policeman". if true, introduce a variable "counter = 0". iterate all the players in the cicle, checking the distance to them by the formula:
dist = sqrt( sqr(x1-x2) + sqr(y1-y2) )
if the distance is less than 250 meters, inside the cicle increment count by 1. Draw a button with coord "Left, Top + height_buttons * counter".

When processing the next packet player can leave the zone of 250 meters, so u need to remove him button. How - you decide. You can clear the entire screen of the buttons before the cycle, or u can delete specific keys, you can use flags to hide the button only once.

Police system idea
(3 posts, started )
FGED GREDG RDFGDR GSFDG