[Possible?] To make a function GetVehicleColor(vehicleID, Col1, Col2);?
#1

Is it possible?
Reply
#2

Simple: no.
Reply
#3

It would be possible if you make your own ChangeVehicleColor funtion with two variables like ColorOne[vehicleid] and ColorTwo[vehicleid] but then you must change every ChangeVehicleColor funtion to your own and you have to change AddStaticVehicle, AddStaticVehicleEx and CreateVehicle to your own because there are colors in that funtions.
Reply
#4

I suppose if you really want to
pawn Код:
// If you cba to change your script
#define AddStaticVehicle AddStaticVehicleEx
#define CreateVehicle CreateVehicleEx
#define ChangeVehicleColor ChangeVehicleColorEx
// Top of script
new Color1[MAX_VEHICLES];
new Color2[MAX_VEHICLES];
// AddStaticVehicle replacement
stock AddStaticVehicleEx(model, Float:x, Float:y, Float:z, Float:angle, color1, color2)
{
  new vehicle;
  vehicle = AddStaticVehicle(model, x, y, z, angle, color1, color2);
  Color1[vehicle] = color1;
  Color2[vehicle] = color2;
  return vehicle;
}
// CreateVehicle replacement
stock CreateVehicleEx(model, Float:x, Float:y, Float:z, Float:angle, color1, color2, respawndelay)
{
  new vehicle;
  vehicle = CreateVehicle(model, x, y, z, angle, color1, color2, respawndelay);
  Color1[vehicle] = color1;
  Color2[vehicle] = color2;
  return vehicle;
}
// ChangeVehicleColor replacement
stock ChangeVehicleColorEx(vehicleid, color1, color2)
{
  ChangeVehicleColor(vehicleid, color1, color2);
  Color1[vehicleid] = color1;
  Color2[vehicleid] = color2;
  return 1;
}
// Get color1
stock GetVehicleColor1(vehicleid)
{
  return Color1[vehicleid];
}
// Get color2
stock GetVehicleColor2(vehicleid)
{
  return Color2[vehicleid];
}
Only a rough guidline BTW
Reply
#5

Quote:
Originally Posted by Westie
You do know that you can edit a_vehicles.inc, and make it so that the original ChangeVehicleColor gets renamed to something like oldChangeVehicleColor, and then you can create a stock with the same name that keeps log of all the colours, so effectively all that is needed for scripts is a recompile, amiryte?
my defines automatically redirect all ChangeVehicleColor, AddStaticVehicle and CreateVehicle to the Ex versions
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)