|
 |
|
|
|
|
|
GTA Modification Forums
PLEASE HELP: Command to change car color in Script
 |
|
 |
| |
motorsport71  |
Posted: Saturday, Jun 2 2012, 02:43
|
newbie modder

Group: Members
Joined: Oct 20, 2009

|
| CODE | | public ColorIndex Color {get; set;} |
in cs (is how Scripthookdotnet documentation lists it). or | CODE | | Public Property Color As GTA.ColorIndex |
in vb Colors are: AgateGreen AlabasterSolid AntelopeBeige AnthraciteGrayPoly ArcticPearl ArcticWhite AscotGray AstraSilverPoly BisqueFrostPoly BistonBrownPoly Black BlackPoly BlazeRed Blue BrightBluePoly BrightBluePoly2 BrightBluePoly3 BrightRed BrightRed2 BrilliantRedPoly BrilliantRedPoly2 CabernetRedPoly CherryRed ClassicRed ClearCrystalBlueFrostPoly ConcordBluePoly CopperBeige CrystalBluePoly CurrantBluePoly CurrantRedPoly CurrantRedSolid DarkBeechwoodPoly DarkGreenPoly DarkSablePoly DarkSapphireBluePoly DarkTitaniumPoly DeepJewelGreen DesertRed DesertRed2 DesertTaupePoly DiamondBluePoly ElectricCurrantRedPoly Flax FormulaRed FrostWhite GarnetRedPoly GracefulRedMica GrayPoly Green Green2 GunMetalPoly HarborBluePoly HoneyBeigePoly Hoods JasperGreenPoly LammyOrange LammyYellow LightBeechwoodPoly LightBlueGrey LightChampagnePoly LightCrystalBluePoly LightDriftwoodPoly LightIvory LightSapphireBluePoly LightSapphireBluePoly2 LightTitaniumPoly MalachitePoly MarinerBlue MediumBeechwoodPoly MediumCabernetSolid MediumFlax MediumGarnetRedPoly MediumGrayPoly MediumGrayPoly2 MediumMauiBluePoly MediumRedSolid MediumSandalwoodPoly MediumSapphireBlueFiremist MediumSapphireBluePoly MedRegattaBluePoly MellowBurgundy MidnightBlue NassauBluePoly NauticalBluePoly OxfordWhiteSolid PastelAlabaster PastelAlabasterSolid PetrolBlueGreenPoly PewterGrayPoly PoliceCarBlue PoliceWhite PorcelainSilverPoly PuebloBeige RaceYellowSolid RioRed SandalwoodFrostPoly SaxonyBluePoly SeafoamPoly SeafoamPoly2 SecuricorDarkGreen SecuricorDarkGreen2 SecuricorLightGray ShadowSilverPoly SilverPoly SilverStonePoly SilverStonePoly2 SlateGray SmokeSilverPoly SpinnakerBlueSolid SteelBluePoly SteelGrayPoly SteelGrayPoly2 StrikingBlue SurfBlue TaxiYellow TaxiYellow2 TempleCurtainPurple TitaniumFrostPoly TorchRed TorinoRedPearl TurismoRed TwilightBluePoly TwilightBluePoly2 UltraBluePoly VermilionSolid VermillionSolid VeryRed VeryWhite WarmGreyMica White WhiteDiamondPearl WildStrawberryPoly WinningSilverPoly WoodrosePoly I only know vb so i would do it this way: | CODE | Dim rental as vehicle = World.CreateVehicle(new Model("TEST"),(new Vector3(921.05980F, -517.1382F, 14.3157F))); rental.Color = Colorindex.Black |
If you want a black car. This post has been edited by motorsport71 on Saturday, Jun 2 2012, 02:54
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
hardsty1e  |
Posted: Saturday, Jun 2 2012, 11:20
|
Rat

Group: Members
Joined: May 2, 2009

|
I tried to convert this from xbox360 to pc but don't know how to work "GENERATE_RANDOM_INT_IN_RANGE" so here are the natives. colour palette http://www.gtamodding.com/index.php?title=Carcols.dat#GTA4| CODE | using System; using System.Collections.Generic; using System.Text; using System.Windows.Forms; using GTA;
namespace carflash { public class carflash : Script { //this.KeyDown +=new GTA.KeyEventHandler(keypressed); this.Tick += new EventHandler(this.carflash_Tick); this.Interval = 50; Wait(0); }
private void carflash_Tick(object sender, EventArgs e) { //GTA.Native.Pointer CarPointer = Player.Character.CurrentVehicle; //if (e.Key == Keys.K) //{ ///////////////////////////////////////////// if (Player.Character.isInVehicle() == true) //if (IS_CHAR_IN_ANY_CAR(GetPlayerPed())) { Vehicle vhcl = Player.Character.CurrentVehicle; //get the car and put it into a variable called car //Car car; GTA.Native.Function.Call("GET_CAR_CHAR_IS_USING", Player.Character, vhcl);
//generate random numbers between 0 and 133 for the random colours, these are picked from the
carcols.dat iirc int a = 1; GTA.Native.Function.Call("GENERATE_RANDOM_INT_IN_RANGE",0,133,a); int b = 2; GTA.Native.Function.Call("GENERATE_RANDOM_INT_IN_RANGE",0,133,b); int c = 3; GTA.Native.Function.Call("GENERATE_RANDOM_INT_IN_RANGE",0,133,c); int d = 4; GTA.Native.Function.Call("GENERATE_RANDOM_INT_IN_RANGE",0,133,d);
/*change the car colour and then the extra colours for the car, done CHANGE_CAR_COLOUR(car, one, two); SET_EXTRA_CAR_COLOURS(car,three,four);*/
GTA.Native.Function.Call("CHANGE_CAR_COLOUR", vhcl, a, b); GTA.Native.Function.Call("SET_EXTRA_CAR_COLOURS", vhcl, c, d); GTA.Native.Function.Call("IMPROVE_CAR_BY_CHEATING", vhcl, 1); }
else { Game.DisplayText("You need to get a vehicle first!"); }
} } } |
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
Southern_Smoke  |
Posted: Saturday, Jun 2 2012, 17:01
|
Player Hater

Group: Members
Joined: Jun 18, 2011


|
Yes!!! i works  .... someone has ideas how I can optimize the script? What do I have to add, that the script will start again ...when a car was stolen? | CODE | // ----------------------------------------------------------------------- // <copyright file="VIPcars" company="Southern_Smoke"> // </copyright> // -----------------------------------------------------------------------
using System; using System.Windows.Forms; using System.IO; using System.Drawing; using GTA; using GTA.Native;
namespace VIPCars { public class VIPCars : Script { Blip bizBlip; Blip rentalBlip;
Vehicle rental = null; Vehicle rental1 = null; Vehicle rental2 = null;
public VIPCars() { Game.DisplayText("Vehicle Spawned");
// Blip for MaschinenPark bizBlip = Blip.AddBlip(new Vector3(2013.8604F, 467.7533F, 17.8433F));//Car Rental bizBlip.Color = BlipColor.Green; bizBlip.Display = BlipDisplay.MapOnly; bizBlip.Name = "Maschinen Park"; // Audi A7 (Testcar) rental = World.CreateVehicle(new Model("TEST"),(new Vector3(921.05980F, -517.1382F, 14.3157F))); GTA.Native.Function.Call("CHANGE_CAR_COLOUR", rental, 15, 133); GTA.Native.Function.Call("SET_EXTRA_CAR_COLOURS", rental, 133, 133); Game.DisplayText("A7 Testcar 1"); // Audi A7 (Testcar2) rental1 = World.CreateVehicle(new Model("TEST"),(new Vector3(921.05980F, -510.1382F, 14.3157F))); GTA.Native.Function.Call("CHANGE_CAR_COLOUR", rental1, 15, 133); GTA.Native.Function.Call("SET_EXTRA_CAR_COLOURS", rental1, 133, 133); Game.DisplayText("A7 Testcar 2"); }
} // End } // End
|
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
Track this topic
Receive email notification when a reply has been made to this topic and you are not active on the board.
Subscribe to this forum
Receive email notification when a new topic is posted in this forum and you are not active on the board.
Download / Print this Topic
Download this topic in different formats or view a printer friendly version.
| |
 |
|
 |
|
|
|
|