IMG

 
IMG
IMG   IMG
  Welcome to GTAForums! Be sure to check out the Grand Theft Auto V Forum.

You are not registered! (If you are, click here to login) Registering is fast, free and easy and allows you to instantly reply to any topic on GTAForums.
Why wait? Click here to register your own unique username and become part of the ever-growing community!


( Log In | Register | Revalidate Validation E-mail )
Quick Log-In:
  IMG
       
>
Forum Rules GTA Modification Forums

Post mod/code requests in the Mod Requests topic

Post mod releases in the Mod Showroom

Read the Modding Rules BEFORE posting!

GTAGarage.com
free mod hosting from GTANet, simply login with your GTAForums account details

GTAModding.com
GTANet's modding wiki

GTA Modding Chatroom
provided by irc.gtanet.com (Don't have an IRC client? Click here)


  Reply to this topicStart new topicStart Poll

 PLEASE HELP: Command to change car color in Script

 
Southern_Smoke  
Posted: Saturday, Jun 2 2012, 00:11
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Jun 18, 2011

gr.gif

XXXXX



Hi confused.gif ,

does anyone know the command for cs. script with which you can change the color of the car? This is the Script part:

CODE

       public VIPCars()
       {
           Game.DisplayText("Vehicle Spawned");

           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";
           rental = World.CreateVehicle(new Model("TEST"),(new Vector3(921.05980F, -517.1382F, 14.3157F)));
           
           !!!!!!!I NEED HERE THE CODE FOR CHANGE THE COLOR!!!!!!!!!
       }

PM
  Top
 

 
motorsport71  
Posted: Saturday, Jun 2 2012, 02:43
Quote Post


newbie modder
Group Icon
Group: Members
Joined: Oct 20, 2009

XXXXX



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
PM
  Top
 

 
hardsty1e  
Posted: Saturday, Jun 2 2012, 11:20
Quote Post


Rat
Group Icon
Group: Members
Joined: May 2, 2009

XXXXX



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!");
       }
       

       }
   }
}
PM
  Top
 

 
Southern_Smoke  
Posted: Saturday, Jun 2 2012, 17:01
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Jun 18, 2011

gr.gif

XXXXX



Yes!!! i works biggrin.gif .... 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? dozingoff.gif

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

       




PM
  Top
 

 

1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)

0 Members:

Topic Options Reply to this topicStart new topicStart Poll
Search topic for posted by (exact match)



 
IMG IMG