YossiBz 2 Posted January 26, 2015 i try to set color to vehicle and its save on the file but i want to spawn the vehicle its change color here my script: GTA.Forms.ColorDialog cd = new GTA.Forms.ColorDialog(); cd.AllowScrollbars = true; Vehicle veh = Game.LocalPlayer.Character.CurrentVehicle; if (veh != null) { if (Settings.GetValueString("Vehicle") == veh.Name.ToString()) { cd.SelectedColorGTA = veh.Color; if (cd.ShowDialog() == DialogResult.OK) { veh.Color = cd.SelectedColorGTA; Settings.SetValue("Color", Convert.ToInt32(cd.SelectedColorRGB.Name,16)); } cd.Close(); } } example:its save the color like this: Color=fffc6d00 Share this post Link to post Share on other sites
Jitnaught 370 Posted January 26, 2015 (edited) I'm guessing what you're asking is how to get the Color from the Settings file? If so, change Settings.SetValue("Color", Convert.ToInt32(cd.SelectedColorRGB.Name,16)); in your code to Settings.SetValue("Color", cd.SelectedColorRGB.Name); then put this code in when you get the Color Color color = Color.FromName(Settings.GetValueString("Color")); Edited January 26, 2015 by LetsPlayOrDy Share this post Link to post Share on other sites
YossiBz 2 Posted January 26, 2015 (edited) I'm guessing what you're asking is how to get the Color from the Settings file? If so, change Settings.SetValue("Color", Convert.ToInt32(cd.SelectedColorRGB.Name,16)); in your code to Settings.SetValue("Color", cd.SelectedColorRGB.Name); then put this code in when you get the Color Color color = Color.FromName(Settings.GetValueString("Color")); thank you very much but how i write in the code Vehicle veh = World.CreateVehicle(car, Player.Character.Position.Around(5f)); Color color = Color.FromName(Settings.GetValueString("Color")); veh.Color = color; veh.NoLongerNeeded(); Player.Character.WarpIntoVehicle(veh, VehicleSeat.Driver); its give me error Error 1 Cannot implicitly convert type 'System.Drawing.Color' to 'GTA.ColorIndex' C:\Users\Yossi\documents\visual studio 2010\Projects\Seller\Seller\Seller.cs 316 25 Seller Edited January 26, 2015 by YossiBz Share this post Link to post Share on other sites
Jitnaught 370 Posted January 27, 2015 but how i write in the code Vehicle veh = World.CreateVehicle(car, Player.Character.Position.Around(5f)); Color color = Color.FromName(Settings.GetValueString("Color")); veh.Color = color; veh.NoLongerNeeded(); Player.Character.WarpIntoVehicle(veh, VehicleSeat.Driver); its give me error Error 1 Cannot implicitly convert type 'System.Drawing.Color' to 'GTA.ColorIndex' C:\Users\Yossi\documents\visual studio 2010\Projects\Seller\Seller\Seller.cs 316 25 Seller If you want me to reply to you, make another reply instead of editing your last post and PMing me. If you want to do that, you will have to save the ColorIndex instead of the System.Drawing.Color. Like so Settings.SetValue("Color", (int)cd.SelectedColorGTA); //setColorIndex color = (ColorIndex)Settings.GetValueInteger("Color"); //get Share this post Link to post Share on other sites
YossiBz 2 Posted January 29, 2015 but how i write in the code Vehicle veh = World.CreateVehicle(car, Player.Character.Position.Around(5f)); Color color = Color.FromName(Settings.GetValueString("Color")); veh.Color = color; veh.NoLongerNeeded(); Player.Character.WarpIntoVehicle(veh, VehicleSeat.Driver); its give me error Error 1 Cannot implicitly convert type 'System.Drawing.Color' to 'GTA.ColorIndex' C:\Users\Yossi\documents\visual studio 2010\Projects\Seller\Seller\Seller.cs 316 25 Seller If you want me to reply to you, make another reply instead of editing your last post and PMing me. If you want to do that, you will have to save the ColorIndex instead of the System.Drawing.Color. Like so Settings.SetValue("Color", (int)cd.SelectedColorGTA); //setColorIndex color = (ColorIndex)Settings.GetValueInteger("Color"); //get its give me error: Error 1 Cannot convert type 'GTA.ColorIndex' to 'int' C:\Users\Yossi\documents\visual studio 2010\Projects\Seller\Seller\Seller.cs 232 68 Seller Share this post Link to post Share on other sites
Jitnaught 370 Posted January 29, 2015 I didn't write that code in Visual Studio, so I did not see that error. Settings.SetValue("Color", cd.SelectedColorGTA.Index); //setColorIndex color = (ColorIndex)Settings.GetValueInteger("Color"); //get Share this post Link to post Share on other sites
YossiBz 2 Posted January 29, 2015 I didn't write that code in Visual Studio, so I did not see that error. Settings.SetValue("Color", cd.SelectedColorGTA.Index); //setColorIndex color = (ColorIndex)Settings.GetValueInteger("Color"); //get thank you very much its work Share this post Link to post Share on other sites