Make a default car color? -
insus100 - 03.12.2017
Hello!
So I have really no idea about how to do this xd
Well, I want on my server to make lvpd car (id: 59

to be white and green (green id: 16) instead of white and black every time it gets spawned by any means. Is there any way I can do this?
Thank you!!
Re: Make a default car color? -
AjaxM - 03.12.2017
PHP код:
CreateVehicle(vehicletype, Float:x, Float:y, Float:z, Float:rotation, color1, color2, respawn_delay, addsiren=0)
Change color1 and color2 to your colours.
Re: Make a default car color? -
insus100 - 03.12.2017
I tried that but in my server you have to choose your car, and when the pursuit begins, It will spawn, but if you selected LSPD car, it will appear green too. I know I may not be explaining ok, you'll need to test it know understand me right maybe.
Re: Make a default car color? -
Kraeror - 03.12.2017
I think you should use the function ChangeVehicleColor function to OnVehicleSpawn callback

I hope you understand, why I want to say
Re: Make a default car color? -
insus100 - 03.12.2017
Yeah, I deleted that callback, I reminded. So it would be something like
public OnVehicleSpawn...
if vehicleid == 598
ChangeVehicleColor.....
Right? Sorry for bad code, Im on my phone
Re: Make a default car color? -
Kraeror - 03.12.2017
Quote:
Originally Posted by insus100
Yeah, I deleted that callback, I reminded. So it would be something like
public OnVehicleSpawn...
if vehicleid == 598
ChangeVehicleColor.....
Right? Sorry for bad code, Im on my phone
|
Yes right, try this and if it works, just +REP me my friend
Re: Make a default car color? -
insus100 - 03.12.2017
I'll do, thanks bro
Re: Make a default car color? -
raydx - 03.12.2017
Quote:
Originally Posted by insus100
I tried that but in my server you have to choose your car, and when the pursuit begins, It will spawn, but if you selected LSPD car, it will appear green too. I know I may not be explaining ok, you'll need to test it know understand me right maybe.
|
Just make a check for LVPD only:
Код:
if(GetVehicleModel(vehicleid) == 598)
Re: Make a default car color? -
Abagail - 03.12.2017
OnVehicleSpawn is not called for newly created cars, so no that will not work as intended. You could either manually go through your script and change the colors yourself, or you could hook CreateVehicle, CreateVehicleEx (and AddStaticVehicle(Ex) if you have cars spawned at server launch too).
You could either hook this yourself in your script or use an include such as
this (see the OnVehicleCreated callback).
Re: Make a default car color? -
insus100 - 03.12.2017
Yeah I realised, OnVehicleSpawn is only for respawning vehicles, I will be trying that include now, it should work fine.