Changing car color not working[Command]

Started by Mötley, May 16, 2016, 03:12 AM

Previous topic - Next topic

Mötley

Okay so I am still working on a vehicle saving system for owner/admins but the command I am working on does not do any thing unluckily no error as well. So maybe this is not on my part ???

::The simple code
  if  ( cmd == "colour" ) {
    if (!text) {
       MessagePlayer("This command changes your car's paintjob. Example: /color 255 0 0", player);
       return true;
    }
    if ( !player.Vehicle ) {
       MessagePlayer( "Must be in a car", player );
       return true;
     }
     if ( player.Vehicle ) {
        local
      params = split(text, " "),
              r = params[0].tointeger(),
              g = params[1].tointeger(),
              b = params[2].tointeger();
              player.Vehicle.Colour1 = RGB( r, g, b );
      MessagePlayer( "Color Changed", player );
      return true;
      }
  }
Code jumped sorry

solved sorry i dont know what i was thinking

  if ( cmd == "colour" )  {
    if (!text) {
       MessagePlayer("This command changes your car's paintjob. Example: /c1 25 70", player);
       return true;
    }
    if ( !player.Vehicle ) {
   MessagePlayer( "Must be in a car", player );
   return true;
}
if ( player.Vehicle ) {
      local
      params = split(text, " "),
          r = params[0].tointeger(),
          g = params[1].tointeger();
          player.Vehicle.Colour1 =  r, g ;
  MessagePlayer( "Color Changed", player );
  return true;
    }
  } 
Code jumped sorry

DizzasTeR

The car colors are not RGB based, hope it comes quick though in future but anyways, there are specific car colors in vcmp with IDs that you can use.

Car Color

Always take a look at Wiki for the format. It's vehicle.Colour1 = color ID

Mötley

Ya I was really sad to see that RGB( r, g, b); does not work until i placed it in the same format as create vehicle

and realized the fix above will not work as the color needs to be

player.Vehicle.Colour1 =   r ;
player.Vehicle.Colour2 =   g ;