YossiBz Posted January 26, 2015 Share 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 Link to comment https://gtaforums.com/topic/763876-c-vehicle-color-from-file/ Share on other sites More sharing options...
Jitnaught Posted January 26, 2015 Share 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 Link to comment https://gtaforums.com/topic/763876-c-vehicle-color-from-file/#findComment-1066881506 Share on other sites More sharing options...
YossiBz Posted January 26, 2015 Author Share 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 Link to comment https://gtaforums.com/topic/763876-c-vehicle-color-from-file/#findComment-1066883272 Share on other sites More sharing options...
Jitnaught Posted January 27, 2015 Share 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 Link to comment https://gtaforums.com/topic/763876-c-vehicle-color-from-file/#findComment-1066888048 Share on other sites More sharing options...
YossiBz Posted January 29, 2015 Author Share 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 Link to comment https://gtaforums.com/topic/763876-c-vehicle-color-from-file/#findComment-1066894368 Share on other sites More sharing options...
Jitnaught Posted January 29, 2015 Share 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 Link to comment https://gtaforums.com/topic/763876-c-vehicle-color-from-file/#findComment-1066894903 Share on other sites More sharing options...
YossiBz Posted January 29, 2015 Author Share 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 Jitnaught 1 Link to comment https://gtaforums.com/topic/763876-c-vehicle-color-from-file/#findComment-1066895643 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now