Graphicscore Posted June 14, 2015 Share Posted June 14, 2015 Hello, I am searching a way to retrieve the hash name (from the enum) by the hash itself, for example I have a vehicle and I want to get the enum hash name for that vehicle how can I do that ? I tried this : Enum.GetName(typeof(VehicleHash), player.Character.CurrentVehicle.GetHashCode()) But it returns null , any ideas ? Link to comment Share on other sites More sharing options...
Inco Posted June 14, 2015 Share Posted June 14, 2015 VehicleHash.Adder.ToString() ? Link to comment Share on other sites More sharing options...
Graphicscore Posted June 14, 2015 Author Share Posted June 14, 2015 VehicleHash.Adder.ToString() ? No I want to get the name "Adder" by the hash, for example I enter a vehicle I don't know but I want to get the Hash Name for further usage. Example the hash = player.currentVehicle.getHash(), HashSearch(hash) -> returns "Adder" Link to comment Share on other sites More sharing options...
Inco Posted June 14, 2015 Share Posted June 14, 2015 (edited) Oh, sorry. string modelName = ( (VehicleHash)player.CurrentVehicle.Model.Hash ).ToString(); // returns string// orVehicleHash modelHash = (VehicleHash)player.CurrentVehicle.Model.Hash; // returns value from VehicleHash enumP.S. Also, GetHashCode() - it's standart C# method Edited June 14, 2015 by Inco Jitnaught 1 Link to comment Share on other sites More sharing options...
Graphicscore Posted June 14, 2015 Author Share Posted June 14, 2015 (edited) Oh, sorry. string modelName = ( (VehicleHash)player.CurrentVehicle.Model.Hash ).ToString(); // returns string// orVehicleHash modelHash = (VehicleHash)player.CurrentVehicle.Model.Hash; // returns value from VehicleHash enumP.S. Also, GetHashCode() - it's standart C# method I know that one though , hah but that is still not what I want to know. I try again. To create cars you can use the VehicleHash right like VehicleHash.Adder, and I want to get ADDER if I search for the hash , understand ? Detailed example : There this bike ingame , one that I don't know, I think , "Oh man I want to spawn this one later", I hop onto the bike and a text pops up telling me "This is the vehicle VehicleHash.CARBONRS", not the displayname , the actual Variable Name of the value. Is that possible ? Edited June 14, 2015 by Graphicscore Link to comment Share on other sites More sharing options...
Inco Posted June 14, 2015 Share Posted June 14, 2015 (edited) ( (VehicleHash)player.CurrentVehicle.Model.Hash ).ToString() returns not the display name. It's just transforms the enum value to string. For example, if you are in Franklin Buffalo it will return Buffalo2, not Buffalo S. Detailed example: Edited June 14, 2015 by Inco Jitnaught 1 Link to comment Share on other sites More sharing options...
Graphicscore Posted June 14, 2015 Author Share Posted June 14, 2015 ( (VehicleHash)player.CurrentVehicle.Model.Hash ).ToString()returns not the display name. It's just transforms the enum value to string. For example, if you are in Franklin Buffalo it will return Buffalo2, not Buffalo S. Detailed example: sh*t I owe you a drink XD , thank you. Link to comment Share on other sites More sharing options...
frodzet Posted June 14, 2015 Share Posted June 14, 2015 Inco, can i ask you how you display that Buffalo2? Is that just the UI.ShowSubtitles? Or is there a better way to display info? :-) Link to comment Share on other sites More sharing options...
Inco Posted June 14, 2015 Share Posted June 14, 2015 Inco, can i ask you how you display that Buffalo2? Is that just the UI.ShowSubtitles? Or is there a better way to display info? :-) Yeah, it's UI.ShowSubtitle. You can also use UI.Notify (notification above the mini map). Link to comment 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