Jump to content

Welcome to GTAPoliceMods

Welcome to GTAPoliceMods, like most online communities you must register to interact or post within our community, but don't worry this is a simple free process that requires minimal information for you to signup. Guests can NOT download files. This is to prevent bots and malicious users. If you wish to have these restrictions removed, you can create an account or signing in. By signing up you gain the ability to...

  • Download and upload unlimited files
  • Access to the Marketplace
  • Start new topics and reply to others
  • Upload Gallery Images
  • Subscribe to topics and forums to get email updates
  • Get your own profile page and make new friends
  • Send personal messages to other members.

martuksxxxx

[SUGGESTION] Any car, cop car.

Recommended Posts

A script that would allow any car to be a cop car. For example for undercover cop units on fivem servers.

  • Like 2

Share this post


Link to post
Share on other sites

I mean, It's not a bad idea, although you could always take a vehicle and put it as an addon police car and get the same result.


Do not click this spoiler

 

1King21

giphy.gif

Share this post


Link to post
Share on other sites

You are right, but problem with that is:

1. It takes time to convert vehicle to addon

2. Undercover police addon vehicles get meta-gamed

 

I would imagine that thing would like a menu, you activate it and car you drive gets a police siren, the tricky part from scripting perspective would be police lights, I am thinking maybe have that menu ability to spawn 4 props (one for each side) and they would glow whenever siren get activated or smth. But props would need to be adjustible on XYZ axis in the menu, because each car is different size etc. I dont know, that is what my imagination is thinking.

Share this post


Link to post
Share on other sites

Agreed, But even if it's just an outright normal car and gets thrown in a police slot it's going to do the same thing as a script. I'm not even sure it would be possible for some of it but then again, I don't code, so I very well may be wrong. It wouldn't be that hard seeing as how you're talking about for FiveM most vehicle packs already come as addons, all that would really need to be done is to change a name or two and then maybe the handling depending on the vehicle you want on there.


Do not click this spoiler

 

1King21

giphy.gif

Share this post


Link to post
Share on other sites

Big thing is modelling police light for addon cars, and |I play on a server, we have 3 undercover cars, after first few days whole server knows that those cars are the ones undercover units use, so metagaming goes wild "I am not selling cocain, its baking powder". Having ability for any car to be cop car at any time, would be awesome.

 

From coding perspective, polce lights will be the tricky part, adding a siren (sound) is not difficult, but having working, bright props that glow like police is something I cant think of how to do. That's why I put this in suggestions.

Share this post


Link to post
Share on other sites
7 hours ago, martuksxxxx said:

~snip~

 

I get it, it's the same thing SAMP had back in the day for cars. Although I'm not positive on how or if it could be done for it. Only thing I can suggest without having a script like that is to go and make rules against it. There's a reason why SAMP servers had them back in the day. Although if someone is willing to attempt to make your suggestion, more power to them.

  • Like 1

Do not click this spoiler

 

1King21

giphy.gif

Share this post


Link to post
Share on other sites
On 11/1/2019 at 8:06 PM, martuksxxxx said:

A script that would allow any car to be a cop car

Cool idea

On 11/3/2019 at 12:27 PM, Luckyx49 said:

It's not a bad idea

Agreed

On 11/3/2019 at 6:07 PM, martuksxxxx said:

the tricky part from scripting perspective would be police lights

Agreed again

On 11/3/2019 at 6:07 PM, martuksxxxx said:

ability to spawn 4 props (one for each side) and they would glow whenever siren get activated or smth

Interesting idea.... (being genuine, not sarcastic)

On 11/3/2019 at 6:07 PM, martuksxxxx said:

But props would need to be adjustible on XYZ axis in the menu, because each car is different size etc

This ^

7 hours ago, martuksxxxx said:

From coding perspective, polce lights will be the tricky part, adding a siren (sound) is not difficult

Also this ^

 

The thing is, from a GTA V prescriptive, it's going to be a hell of a lot easier (relativity) to take a normal car and model lights onto it, then it is to try and script them on. Your idea with using props is not a bad one to be honest, however, there are two major issues with it, both of which you've already pointed out:

 

1) Positioning of props

2) Flash Effect/s in/on/from said props

 

Your idea regarding a menu to adjust the position is also not a bad one at all; it's not an ideal solution, but it could work. The actual flashing would need to be achieved through natives though, somehow...

 

You've peaked my interest to be honest, so I'll have a look into this idea, and get back to you guys in a bit 👌

Edited by Christopher
typos
  • Like 1

Share this post


Link to post
Share on other sites

Ok, so I spent a bit of time on it, and, well, it's do-able, kinda. As I suspected, it's a bit fiddly, however, it 'works'. Here's a W.I.P video (keeping in-mind that the final product, if any at all, may not represent this), I'll explain how I achieved this later: it's 3:30 AM, time to pass out.

 

https://streamable.com/nbcxq

Share this post


Link to post
Share on other sites
13 hours ago, Christopher said:

What you did is actually pretty damn good,, however if I may suggest something.
You got lighting right on the spot, so lighting problem is solved

However there is no light indication on the vehicle itself, if 4 props are too much, maybe use just one like this:

XYZ prop movement  while attached to object its center being 0 coordinate is present on TrainerV (simple trainer) and menyoo (open source on github), so that might help.

Share this post


Link to post
Share on other sites
7 hours ago, martuksxxxx said:

It would probably be best to make it it's own menu, A lot of servers don't like to use menus, so using its own little menu would probably be easier and would get more downloads.


Do not click this spoiler

 

1King21

giphy.gif

Share this post


Link to post
Share on other sites
7 hours ago, martuksxxxx said:

However there is no light indication on the vehicle itself, if 4 props are too much, maybe use just one like this:

Yeah I needed to do some more research into how to achieve that, which I have since done 😛 Here's what I have so far:

 

https://streamable.com/k0ek6

 

I'll briefly run through how it works, thus far.

 

Firstly, I dumped the objects/props altogether. Other than aesthetics, they served no real purpose, in that even though I was attaching my flashing lights to them, there was no viable bloom or corona, so it was a bit pointless: the light was attached to the object attached to the bone attached to the car - now the light is attached straight to the bone on the car, cutting out the middle man per se. I was also running into some strange Vector issues while the lights were attached to the object; something to do with the Forward Vector of the car vs. the Placement Vector of the object vs. the Placement Vector of the light and the Direction Vector of the light - long story short the lights were going out the completely wrong angle, and moved with the car exponentially (in the wrong directions).

 

There are 4 'flashing lights', these are placed on the head and tail light bones of the vehicle in use, with the Placement Vector of the tail light lights of course being reversed (because we want them facing backwards 😉). At the moment, they are in a fixed flash pattern, however, I'm looking at making it a bit easier to make flash patterns, without needing to hard code them like they are currently. Another issue I ran into was the lights themselves, as the light native needs to be run per-frame in a loop, which normally would be fine, however, in order to achieve multiple flashing lights at once, they each had to be placed in their own Thread, which caused it own set of problems (namely, variable scope issues, because FiveM is a pain like that). At the moment, 4 Threads are created, they make the 4 lights flash, the Threads are destroyed, and the process repeats. This is not an ideal solution, as I'm not sure running a ton of threads is a great idea, from a stability standpoint anyways; but for now, it works.

 

The actual 'light indication'/bloom/corona/etc, whatever you want to call it - this was the real pain in my arse. I settled for head/tail light color and flashing, because I could not for the life of me figure out how to create a corona effect. I even tried FX: nothin. If anyone has any idea how to create that effect at a coord/on an entity/etc, please, let me know 😆

 

Finally, the siren. In the video, I am using a clean copy of Luxart, modified (or as it sounds cooler to say, 'hacked') to replace the dependency on the native vehicle siren check to instead use my own. Other than doing this because it was cool to do so, it was actually a required step, because I could not find a way to change a vehicle's class on the fly, so the 'emergency vehicle' check always failed; additionally, Luxart works normally by using a vehicle's stock emergency lights, muting its default siren, and then placing its own, however, in our case, we don't have stock lights or siren, and thus failed that check as well. In the end, I more or less jerry-rigged it together using most of the Luxart code, with a splash of my own, and removed some of the unneeded stuff, like Fire Engine sirens (no undercover Engines, sowwy.) and it works, kinda. Also, the modded version of Luxart only affects the 'converted' vehicles, so running normal Luxart or ELS is not an issue.

 

Two important things to note from the video:

 

1) You will notice traffic does not yield to me, this is because the siren is added on with code, and so are the lights, so as far as the AI is concerned, you are just a normal driver. While this is not really such a bad thing, in that in real life people are not great to yielding to undercover cars, there is also no easy fix, that I can find at least, and this really boils down to the vehicle class, which I have yet to find a way to set on the fly, as it is defined in the meta files for the vehicle.

 

2) There is a delay when turning on and off the lights. This is a result of the Multi-Threading I was talking about, and the variable scope BS. Long story short: Lights goes off, script unsets the variables, but the Threads have their own copy of the data, that is not updated until the Thread is destroyed and recreated (the delay you can see on-screen). I'll find a fix, later... maybe.

 

3) The lag was just my screen capture, the script runs very well, as only 0.1 - 0.4 ms of frame time.

 

Anyway, that's what I have so far. [/nerd stuff]

Edited by Christopher

Share this post


Link to post
Share on other sites

Genius, I didnt even thing of using those lights, I had my head set on props so much I forgot alternatives.

But dude, holy shit, what you did already is beyond anything other people have done for years since this feature was requested.

Actually you dont even need to do anything else, it is already in top condition.

If this will be ever released, will it be server sided?

  • Like 1

Share this post


Link to post
Share on other sites
8 hours ago, martuksxxxx said:

If this will be ever released

Yeah definitely lol, I release everything I make; although this isn't ready to ship just yet, still needs some networking done to it.

 

8 hours ago, martuksxxxx said:

will it be server sided

If you're asking whether it is a server resource, yes it is; if you're asking wether it will function entirely on a server script, then no, because a lot of the vehicle natives are client side only.

 

Watch this space ;)

  • Like 1

Share this post


Link to post
Share on other sites

Haha, good work, cant wait. I will check your profile for uploads if anything 😄

 

Also, just to verify, will you need sv_scripthook 1 for this to work?

Share this post


Link to post
Share on other sites

Haha sounds awesome.

Also, in the video I noticed that back lights arent Red and  Blue. On the vehicle I mean. Will they stay that way?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

Please view the site: Terms of Use, Privacy Policy, and Guidelines. // IMPORTANT: We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.