ikt Posted April 30, 2017 Share Posted April 30, 2017 Hi! The popular trainer/menu Menyoo can detect add-on cars and show them in the list with available vehicles to spawn. Since the menu itself doesn't work well with script reloading, I wanted to get this feature stand-alone. Thing is, I can't seem to find any natives related to returning all available vehicles. Do they manage a list of available mod vehicles themselves? Seems doubtful to me. What I did find was all DLC vehicles. Nothing for all add-ons though int num = DLC1::GET_NUM_DLC_VEHICLES(); logger.Write("# of DLC Vehs: " + std::to_string(num)); for (int i = 0; i < num; i++) { Hash dlcVeh = DLC1::GET_DLC_VEHICLE_MODEL(i); if (dlcVeh) { char *name = VEHICLE::GET_DISPLAY_NAME_FROM_VEHICLE_MODEL(dlcVeh); if (name) { logger.Write(std::to_string(i) + " " + name + " " + std::to_string(static_cast<int>(dlcVeh))); } } }Which indeed returns a 197-element large list of all official DLC vehicles in the images. Manual add-on vehicles are missing though. Is there a way for those vehicles? Link to comment Share on other sites More sharing options...
alloc8or Posted April 30, 2017 Share Posted April 30, 2017 The solution is to scan the model hash table for all vehicle models. See SHVDN's GenerateVehicleModelList(). ikt 1 Link to comment Share on other sites More sharing options...
ikt Posted April 30, 2017 Author Share Posted April 30, 2017 Ah, it wasn't as simple as I hoped it would be. Thanks Link to comment Share on other sites More sharing options...
unknown modder Posted April 30, 2017 Share Posted April 30, 2017 Ah, it wasn't as simple as I hoped it would be. Thanks thats just because the code isn't very clear, If you find the function in the exe its much nicer Link to comment Share on other sites More sharing options...
ikt Posted April 30, 2017 Author Share Posted April 30, 2017 (edited) Ah, it wasn't as simple as I hoped it would be. Thanks thats just because the code isn't very clear, If you find the function in the exe its much nicer Well, most of it is pretty clear. What modelNum1-4 are/do is unclear to me and why the model list is an array of 32 lists is odd. The code works fine now though, so I'll just need to filter out the normal and DLC vehicles. Would you/crosire mind if this would be released standalone? Edit - Oh, each vector is a group of vehicles. Didn't know R* would store them like that Additional question: Aside from comparing them to a hard-coded list of already present vehicle hashes, is there a better way? Edited April 30, 2017 by ikt Link to comment Share on other sites More sharing options...
unknown modder Posted April 30, 2017 Share Posted April 30, 2017 Ah, it wasn't as simple as I hoped it would be. Thanks thats just because the code isn't very clear, If you find the function in the exe its much nicer Well, most of it is pretty clear. What modelNum1-4 are/do is unclear to me and why the model list is an array of 32 lists is odd. The code works fine now though, so I'll just need to filter out the normal and DLC vehicles. Would you/crosire mind if this would be released standalone? Edit - Oh, each vector is a group of vehicles. Didn't know R* would store them like that Additional question: Aside from comparing them to a hard-coded list of already present vehicle hashes, is there a better way? I didnt know what they were right when i wrote that code. I now know they correspond to fields in a pool that stores all the pointers to model data. This way is the best way, It never requires updating and it will detect all addon vehicles. It also has the advantage that once you have the framework, you can use it to easily grab info for a specific model(not just vehicles) right from memory. You can see this used in SHV.Net for the IsModelAPed property in the model class - a funciton which is unavailable to replicate with natives. ikt 1 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