Changing vehicle color. -
Dreftas - 25.02.2012
If I go to some building (changing interior and virtual world from 0 to another one) and then leave(changing interior and virtual world back to 0) my vehicle color changes, but changes just those which are near my exit. I don't change it by any function.
Vehicles created with AddStaticVehicle.
Is this really bug or what ?
Re: Changing vehicle color. -
Slash_ - 25.02.2012
it will happen when the vehicle colors are set to random 1,1.
Re: Changing vehicle color. -
Dreftas - 25.02.2012
How to avoid this without removing colors parameters from -1 -1 ?
Re: Changing vehicle color. -
leong124 - 26.02.2012
Hook the AddStaticVehicle function, and script the -1 colour yourself. This actually set the vehicle into a fixed but randomly chosen colour, but not -1.
Example:
pawn Код:
//Put this at the top of your script in order to hook the original function.
AddStaticVehicle_hooked(modelid, Float:spawn_x, Float:spawn_y, Float:spawn_z, Float:z_angle, color1, color2)
{
if(color1 == -1) color1 = random(128);//All normal vehicle colours in single player
if(color2 == -1) color2 = random(128);
AddStaticVehicle(modelid, spawn_x, spawn_y, spawn_z, z_angle, color1, color2);
}
#define AddStaticVehicle AddStaticVehicle_hooked
Re: Changing vehicle color. -
Dreftas - 26.02.2012
Fixed without hooking, but thanks
Re: Changing vehicle color. -
KingHual - 26.02.2012
Quote:
Originally Posted by leong124
Hook the AddStaticVehicle function, and script the -1 colour yourself. This actually set the vehicle into a fixed but randomly chosen colour, but not -1.
Example:
pawn Код:
//Put this at the top of your script in order to hook the original function. AddStaticVehicle_hooked(modelid, Float:spawn_x, Float:spawn_y, Float:spawn_z, Float:z_angle, color1, color2) { if(color1 == -1) color1 = random(128);//All normal vehicle colours in single player if(color2 == -1) color2 = random(128); AddStaticVehicle(modelid, spawn_x, spawn_y, spawn_z, z_angle, color1, color2); } #define AddStaticVehicle AddStaticVehicle_hooked
|
He doesn't really need hooks. He can just use[code random(12
[/code] in the color params.