Changing vehicle color.
#1

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

it will happen when the vehicle colors are set to random 1,1.
Reply
#3

How to avoid this without removing colors parameters from -1 -1 ?
Reply
#4

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

Fixed without hooking, but thanks
Reply
#6

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


Forum Jump:


Users browsing this thread: 1 Guest(s)