Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: Mötley on May 16, 2016, 03:12 AM

Title: Changing car color not working[Command]
Post by: Mötley on May 16, 2016, 03:12 AM
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
Title: Re: Changing car color not working[Command]
Post by: DizzasTeR on May 16, 2016, 03:45 AM
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 (http://wiki.vc-mp.org/wiki/Car_Colors)

Always take a look at Wiki for the format. It's vehicle.Colour1 = color ID
Title: Re: Changing car color not working[Command]
Post by: Mötley on May 16, 2016, 03:51 AM
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 ;