SA-MP Forums Archive
[Include] [INC] GetVehicleColor1 & GetVehicleColor2 - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] [INC] GetVehicleColor1 & GetVehicleColor2 (/showthread.php?tid=150452)



[INC] GetVehicleColor1 & GetVehicleColor2 - Martin_M - 26.05.2010

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.


Re: [INC] GetVehicleColor1 & GetVehicleColor2 - WackoX - 26.05.2010

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



Re: [INC] GetVehicleColor1 & GetVehicleColor2 - Martin_M - 26.05.2010

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


Re: [INC] GetVehicleColor1 & GetVehicleColor2 - WackoX - 26.05.2010

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];
}



Re: [INC] GetVehicleColor1 & GetVehicleColor2 - Joe_ - 26.05.2010

Why not use

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


Re: [INC] GetVehicleColor1 & GetVehicleColor2 - Martin_M - 26.05.2010

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


Re: [INC] GetVehicleColor1 & GetVehicleColor2 - [MWR]Blood - 26.05.2010

Nice and useful
Keep up the good job!


Re: [INC] GetVehicleColor1 & GetVehicleColor2 - Joe_ - 26.05.2010

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)


Re: [INC] GetVehicleColor1 & GetVehicleColor2 - Martin_M - 26.05.2010

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?


Re: [INC] GetVehicleColor1 & GetVehicleColor2 - dice7 - 26.05.2010

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