[Include] [INC] GetVehicleColor1 & GetVehicleColor2
#1

Description
It's simple include, which took me 5 minutes to create. It is not so impressive script, but kinda usefull.

Functions
Code:
CreateStaticVehicle(modelID,Float:X,Float:Y,Float:Z,Float:FacingAngle,colorID1,colorID2);
CreateStaticVehicleEx(modelID,Float:X,Float:Y,Float:Z,Float:FacingAngle,colorID1,colorID2,respawnTime);
AddVehicle(modelID,Float:X,Float:Y,Float:Z,Float:FacingAngle,colorID1,colorID2,respawnTime);
ChangeVehiclePaintjobEx(vehicleid,paintjobid);
GetVehicleColor1(vehicleid);
GetVehicleColor2(vehicleid);
GetVehiclePaintjob(vehicleid);
CreateStaticVehicle - works the same, as https://sampwiki.blast.hk/wiki/AddStaticVehicle
CreateStaticVehicleEx - works the same, as https://sampwiki.blast.hk/wiki/AddStaticVehicleEx
AddVehicle - works the same, as https://sampwiki.blast.hk/wiki/CreateVehicle
ChangeVehiclePaintjobEx - works the same, as https://sampwiki.blast.hk/wiki/ChangeVehiclePaintjob
GetVehicleColor1(vehicleid);
GetVehicleColor2(vehicleid);
GetVehiclePaintjob(vehicleid);

Example:
Code:
public OnPlayerEnterVehicle(playerid,vehicleid,ispassenger)
{
  new string[128];
  format(string, sizeof(string), "My vehicle color1 ID - %d and color2 ID - %d and Paintjob ID - %d",GetVehicleColor1(vehicleid),GetVehicleColor2(vehicleid),GetVehiclePaintjob(vehicleid));
  SendClientMessage(playerid, 0xFFFFFFFF, string);
  return 1;
}
IMPORTANT
If you want to get vehicle's colors and paintjob, you MUST to add vehicles/create vehicles/change paintjob using functions above.

Credits
Martin_M
WackoX for ChangeVehiclePaintjobEx(vehicleid,paintjob); and GetVehiclePaintjob(vehicleid);

Download
http://solidfiles.com/d/9313/
http://pastebin.com/mApgGJBf

You can use, edit it or whatever You want, except appropriate.
Good luck.

P.S.
It's not tested, so You can find bugs, write thems in this topic.
Reply
#2

Nice idea, but it'll bug when you use -1 for a color.
Anyway, nice done!
Reply
#3

Quote:
Originally Posted by WackoX
Nice idea, but it'll bug when you use -1 for a color.
Anyway, nice done!
Thanks, i will think about that.

PASTEBIN ADDED
Reply
#4

Nice,

Maybe you can also put this in your script?
pawn Code:
new Paintjob[MAX_VEHICLES];

ChangeVehiclePaintjobEx(vehicleid, paintjobid)
{
  Paintjob[vehicleid] = paintjobid;
  ChangeVehiclePaintjob(vehicleid, paintjobid);
}

GetVehiclePaintjob(vehicleid)
{
  return Paintjob[vehicleid];
}
Reply
#5

Why not use

pawn Code:
GetVehicleColor(vehicleid, &color1, color2);
Instead of two functions?
Reply
#6

First post updated
Added GetVehiclePaintjob(vehicleid); function by WackoX.
Reply
#7

Nice and useful
Keep up the good job!
Reply
#8

This is out of my vehicle functions

pawn Code:
stock GetVehicleColor(vehicleid, &color1, &color2)
{
color1 = vData[vehicleid][Color1];
color2 = vData[vehicleid][Color2];
return 1;
}

//then it's just

new var1, var2;
GetVehicleColor(vehicle, var1, var2);

//Then the colors are stored into var1 and var2, to be used any way you like

if(var1 != 1) print("ftw");
(Uses an enum to store the arrays)
Reply
#9

Quote:
Originally Posted by Joe_
This is out of my vehicle functions

pawn Code:
stock GetVehicleColor(vehicleid, &color1, &color2)
{
color1 = vData[vehicleid][Color1];
color2 = vData[vehicleid][Color2];
return 1;
}

//then it's just

new var1, var2;
GetVehicleColor(vehicle, var1, var2);

//Then the colors are stored into var1 and var2, to be used any way you like

if(var1 != 1) print("ftw");
(Uses an enum to store the arrays)
Yea, yea.. You cool. I wasn't think about that. Happy now?
Reply
#10

It would also be useful returning the vehicleid upon creating a vehicle
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)