Can anyone tell me if there is a way to check for vehicle add-ons?
-
I'm developing a script that at a certain point I need to know if there is a certain vehicle to start, would anyone know how to tell me how I do this check?
-
@Niziul There are definitely functions to return the vehicle the player is in. Have you checked the native database?
-
@JohnFromGWN Do a search, for example this came up:
PED::GET_VEHICLE_PED_IS_IN
Vehicle GET_VEHICLE_PED_IS_IN(Ped ped, BOOL includeLastVehicle) // 0x9A9112A0FE9A4713 0xAFE92319 b323Gets the vehicle the specified Ped is in. Returns 0 if the ped is/was not in a vehicle.
If the Ped is not in a vehicle and includeLastVehicle is true, the vehicle they were last in is returned.
-
@JohnFromGWN It's true, ScriptHookVDotNet has a class ped which has a property that returns the current Vehicle. I was kind of clueless now, I totally forgot about that one. Thanks again!
-
@JohnFromGWN But would you know how to tell me if there is any method that I can check a specific file in the game files, like to look for any Ymap present in the game?
-
@Niziul I'm not a programmer, but i do know how to refer to a file on disk, so this might help?
lines = System.IO.File.ReadAllLines(@"P:\SteamLibrary\steamapps\common\Grand Theft Auto V\mods\myfile.txt");
so you need to do an "if file exists" construct, that's how i would try.
-
public Vehicle CurrentVehicle
{
get
{
var veh = new Vehicle(Function.Call<int>(Hash.GET_VEHICLE_PED_IS_IN, Handle, false));
return veh.Exists() ? veh : null;
}
}
-
@JohnFromGWN said in Can anyone tell me if there is a way to check for vehicle add-ons?:
@Niziul I'm not a programmer, but i do know how to refer to a file on disk, so this might help?
lines = System.IO.File.ReadAllLines(@"P:\SteamLibrary\steamapps\common\Grand Theft Auto V\mods\myfile.txt");
so you need to do an "if file exists" construct, that's how i would try.
interesting, that's more or less what I wanted, but would I be able to look inside the .rpf files, like in OPenIV.
I'm going to take a look at class File!
-
@Niziul It's impossible to look into .rpf files because they are encrypted and just in general it can't be that easy to look into any archive file. It would be great if OpenIV had a command line api, but I don't think it does. If it does, or if it did, you could send commands. Anyway let us know what you find.
Obviously you can check if the .rpf files, the ones visible in Windows Explorer, exist - but not inside them. Similarly you could check if a folder exists, but there would be caution here too. For example you might want to check if a folder called RCA exists so see if that mod is installed - but folder names can be changed by the user, well the user who knows what he/she is doing.
-
@JohnFromGWN Oh yes! Understand. It's just that I wanted to know which Ymap the user has installed, so I can redirect a mission to that ymap. I think it's easier to generate a .txt file and ask the user for the information manually. Thank you for the explanation!