Make a default car color?
#1

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!!
Reply
#2

PHP код:
CreateVehicle(vehicletypeFloat:xFloat:yFloat:zFloat:rotationcolor1color2respawn_delayaddsiren=0
Change color1 and color2 to your colours.
Reply
#3

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.
Reply
#4

I think you should use the function ChangeVehicleColor function to OnVehicleSpawn callback I hope you understand, why I want to say
Reply
#5

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
Reply
#6

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
Reply
#7

I'll do, thanks bro
Reply
#8

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)
Reply
#9

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).
Reply
#10

Yeah I realised, OnVehicleSpawn is only for respawning vehicles, I will be trying that include now, it should work fine.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)