[JS] Police Pursuit

Started by Vortrex, July 15, 2019, 11:59:16 PM

Previous topic - Next topic

Vortrex

What is it?

Just a couple simple snippets to make police cars chase you if you have a wanted level.



How it works:

If you have a wanted level, and a police car streams in with a police officer NPC driving it, they'll pursue you. Their speed depends on your wanted level. Obviously having a wanted level of 1 will make it easy to escape, while higher levels get more difficult.



Note:

This doesn't spawn any extra vehicles or add higher levels of law enforcement with more vehicles. It only uses what exists to pursue suspects.



Code:

https://pastebin.com/kBeBi72vClient Side[/url]

https://pastebin.com/6xfB1eU6Server Side[/url]

simon_2021

#1
Greetings! Can you help me by telling, what files i need to change or create another files with code for police enable?

Is this need to create standalone plugin, include meta.xml and fileclient.js and fileserver.js, or i need to put these code in existing files? I use config "freecam" resource template to play on the server, which coming with used windows client.



I tried to include the code as a separate plugin, but nothing changed. Also I tried to include the code in the config file of freecam template (.js file) in the same file, that use as default, but nothing changed.



Thanks in advance.

simon_2021

#2
I inform to all who need to play freemode with active cops, and who dont understand how to enable this option. You need change iv_gamemode server option to "16". This option change game, and you'l select cops in game menu after connected to server. I don't know what effect made after the connected code in the first post, but I added it to the Freecam client script and I connected the server code as separate server js script.