husseinh Posted September 11, 2017 Share Posted September 11, 2017 Hallo, i am trying to get the coordinates of the (Cars, Peds, Trains etc..) around me while walking or driving. I've got my position using (Game.Player.character.Position) and saved them in a .txt file. Do anyone know how to get the positions for others? Thanks!! Link to comment Share on other sites More sharing options...
Ezio Baggins Posted September 15, 2017 Share Posted September 15, 2017 World.GetAllEntities() jedijosh920 1 Link to comment Share on other sites More sharing options...
Zeziroth Posted September 15, 2017 Share Posted September 15, 2017 How can i do this in external? Your way just works in an internal or? Link to comment Share on other sites More sharing options...
husseinh Posted September 15, 2017 Author Share Posted September 15, 2017 World.GetAllEntities() Thank you it works:) I'm now using World.getAllPeds() and World.getAllvehicles() to know if it is Ped or Vehicle. Is there any way to know the Kind of the Vehicle? i mean to know if it's a Car or Bus or Train for example? How can i do this in external? Your way just works in an internal or? what do you mean by Internal and external? if you mean online and offline so i'm trying it just for offline Link to comment Share on other sites More sharing options...
Guest Posted September 15, 2017 Share Posted September 15, 2017 (edited) To find what the vehicle is, you can do something like this if (collectedVehicle.Model.IsCar){}else if (collectedVehicle.Model.IsHelicopter){} Or you can test the Class, like this switch (collectedVehicle.ClassType){ case VehicleClass.Coupes: break; case VehicleClass.Helicopters: break;} Edited September 15, 2017 by Guest Link to comment Share on other sites More sharing options...
Zeziroth Posted September 15, 2017 Share Posted September 15, 2017 what do you mean by Internal and external? if you mean online and offline so i'm trying it just for offline Internal is mostly a dll which you inject into the process and then play with its NATIVES and stuff. External is only memory manipulating by accessing the Basepointer + Offsets. From an external coded tool (no injection needed) Link to comment Share on other sites More sharing options...
husseinh Posted September 19, 2017 Author Share Posted September 19, 2017 To find what the vehicle is, you can do something like this if (collectedVehicle.Model.IsCar){}else if (collectedVehicle.Model.IsHelicopter){} Or you can test the Class, like this switch (collectedVehicle.ClassType){ case VehicleClass.Coupes: break; case VehicleClass.Helicopters: break;} Great.it working! Is there anyway to start the Mod Automaticaly? i mean without pressing any Key...so i would like to get the cars around me in real Time! I tried to use: While(Player.isAlive) { //Do } but the Game stoped due to the BigData what do you mean by Internal and external? if you mean online and offline so i'm trying it just for offline Internal is mostly a dll which you inject into the process and then play with its NATIVES and stuff. External is only memory manipulating by accessing the Basepointer + Offsets. From an external coded tool (no injection needed) what do you mean by Internal and external? if you mean online and offline so i'm trying it just for offline Internal is mostly a dll which you inject into the process and then play with its NATIVES and stuff. External is only memory manipulating by accessing the Basepointer + Offsets. From an external coded tool (no injection needed) ok so i'm trying it internal...you can send me a link for external modifications Link to comment Share on other sites More sharing options...
Guest Posted September 19, 2017 Share Posted September 19, 2017 (edited) While and Do loops are intended to be used for situations where you know the condition will change, allowing them to drop out of the loop, they are not ideal for collection processing because they don't iterate through a collection. You could make them do that but there are better solutions. Collect the vehicles into an array or List, then use either a foreach() loop, or a simple for() loop. foreach (Vehicle v in vehiclearray){// Do some stuff} or for (int x = 0; x < vehiclearray.Count; x++){ Vehicle v = vehiclearray[x]; // Do some stuff} That way, once the collection has been processed, the game can continue. I actually wrote up a topic on this subject on GTA5-Mods with an optimised collection/processing system I designed. If you want to have a read of that, it's here. https://forums.gta5-mods.com/topic/5499/tip-code-optimised-getnearbyvehicles-ped-process It's marked as guest now because I closed my account there but I asked them to leave all the posts intact so that the information was left available for other users. Edited September 19, 2017 by Guest Link to comment Share on other sites More sharing options...
husseinh Posted September 20, 2017 Author Share Posted September 20, 2017 (edited) While and Do loops are intended to be used for situations where you know the condition will change, allowing them to drop out of the loop, they are not ideal for collection processing because they don't iterate through a collection. You could make them do that but there are better solutions. Collect the vehicles into an array or List, then use either a foreach() loop, or a simple for() loop. foreach (Vehicle v in vehiclearray){// Do some stuff} or for (int x = 0; x < vehiclearray.Count; x++){ Vehicle v = vehiclearray[x]; // Do some stuff} That way, once the collection has been processed, the game can continue. I actually wrote up a topic on this subject on GTA5-Mods with an optimised collection/processing system I designed. If you want to have a read of that, it's here. https://forums.gta5-mods.com/topic/5499/tip-code-optimised-getnearbyvehicles-ped-process It's marked as guest now because I closed my account there but I asked them to leave all the posts intact so that the information was left available for other users. float x = Game.Player.Character.Position.X; float y = Game.Player.Character.Position.Y; float z = Game.Player.Character.Position.Z; Vehicle[] CollectedVehicle = World.GetNearbyVehicles(Game.Player.Character, 10f); foreach (Vehicle collectedVeh in CollectedVehicle) { Vector3 VehPosition = new Vector3(collectedVeh.Position.X, collectedVeh.Position.Y, collectedVeh.Position.Z); Vector3 PlayerPosition = new Vector3(x, y, z); } Edited September 20, 2017 by husseinh Link to comment Share on other sites More sharing options...
husseinh Posted September 20, 2017 Author Share Posted September 20, 2017 @LeeC2202 I checked the link you sent it and it is really very interresting in how you get the Zones and the Area for the CollectedVehicles and specially the red 3D BOX which is surrounding the Helicopter. v.Model.GetDimensions(); gives me the 3 dimensions of a Car like (X: Y: Z:), but could you tell me please how to get it drown on Screen as you made for your Helicopter? Thank you very much! Link to comment Share on other sites More sharing options...
Guest Posted September 20, 2017 Share Posted September 20, 2017 (edited) @LeeC2202 I checked the link you sent it and it is really very interresting in how you get the Zones and the Area for the CollectedVehicles and specially the red 3D BOX which is surrounding the Helicopter. v.Model.GetDimensions(); gives me the 3 dimensions of a Car like (X: Y: Z:), but could you tell me please how to get it drown on Screen as you made for your Helicopter? Thank you very much! It's actually very simple. Use the function that gets you the minimum and maximum dimensions and build a List<Vector3> of corner points, you will get 8 points. Vector3 MinDimensions = new Vector3();Vector3 MaxDimensions = new Vector3();Vehicle.Model.GetDimensions(out MinDimensions, out MaxDimensions); then something like this. If MinDimensions and MaxDimensions are not defined globally, then you need to put this code in the same function as the one that gets the dimensions above. private void CreatePoints(){ CornerPoints.Clear(); CornerPoints.Add(new Vector3(MinDimensions.X, MinDimensions.Y, MinDimensions.Z)); CornerPoints.Add(new Vector3(MinDimensions.X, MaxDimensions.Y, MinDimensions.Z)); CornerPoints.Add(new Vector3(MaxDimensions.X, MaxDimensions.Y, MinDimensions.Z)); CornerPoints.Add(new Vector3(MaxDimensions.X, MinDimensions.Y, MinDimensions.Z)); CornerPoints.Add(new Vector3(MinDimensions.X, MinDimensions.Y, MaxDimensions.Z)); CornerPoints.Add(new Vector3(MinDimensions.X, MaxDimensions.Y, MaxDimensions.Z)); CornerPoints.Add(new Vector3(MaxDimensions.X, MaxDimensions.Y, MaxDimensions.Z)); CornerPoints.Add(new Vector3(MaxDimensions.X, MinDimensions.Y, MaxDimensions.Z));} Then use the GetOffsetInWorldCoords() function on each of those corner points from the Vehicle and draw lines between them using a drawline function like this. public static void DrawLine(Vector3 start, Vector3 end, Color colour){ Function.Call(Hash.DRAW_LINE, start.X, start.Y, start.Z, end.X, end.Y, end.Z, colour.R, colour.G, colour.B, colour.A);} That will ensure that no matter how the model rotates, the corners will rotate relative to it. This also works for Peds and Props of course, it's not just for Vehicles. I should just add, you should only collect the corner points once and then store those in a class that links those corners with that Vehicle. You don't want to be grabbing model dimensions every frame, it's just wasted cycles if you do that. Or you could create a Dictionary<int, List<Vector3>> that has the model hash as the key and the corner points as the DIctionary value. Like everything, there are many ways to achieve the goal, you just have to find the one that you are most comfortable using. Edited September 20, 2017 by Guest Link to comment Share on other sites More sharing options...
husseinh Posted September 25, 2017 Author Share Posted September 25, 2017 @LeeC2202 I checked the link you sent it and it is really very interresting in how you get the Zones and the Area for the CollectedVehicles and specially the red 3D BOX which is surrounding the Helicopter. v.Model.GetDimensions(); gives me the 3 dimensions of a Car like (X: Y: Z:), but could you tell me please how to get it drown on Screen as you made for your Helicopter? Thank you very much! It's actually very simple. Use the function that gets you the minimum and maximum dimensions and build a List<Vector3> of corner points, you will get 8 points. Vector3 MinDimensions = new Vector3();Vector3 MaxDimensions = new Vector3();Vehicle.Model.GetDimensions(out MinDimensions, out MaxDimensions); then something like this. If MinDimensions and MaxDimensions are not defined globally, then you need to put this code in the same function as the one that gets the dimensions above. private void CreatePoints(){ CornerPoints.Clear(); CornerPoints.Add(new Vector3(MinDimensions.X, MinDimensions.Y, MinDimensions.Z)); CornerPoints.Add(new Vector3(MinDimensions.X, MaxDimensions.Y, MinDimensions.Z)); CornerPoints.Add(new Vector3(MaxDimensions.X, MaxDimensions.Y, MinDimensions.Z)); CornerPoints.Add(new Vector3(MaxDimensions.X, MinDimensions.Y, MinDimensions.Z)); CornerPoints.Add(new Vector3(MinDimensions.X, MinDimensions.Y, MaxDimensions.Z)); CornerPoints.Add(new Vector3(MinDimensions.X, MaxDimensions.Y, MaxDimensions.Z)); CornerPoints.Add(new Vector3(MaxDimensions.X, MaxDimensions.Y, MaxDimensions.Z)); CornerPoints.Add(new Vector3(MaxDimensions.X, MinDimensions.Y, MaxDimensions.Z));} Then use the GetOffsetInWorldCoords() function on each of those corner points from the Vehicle and draw lines between them using a drawline function like this. public static void DrawLine(Vector3 start, Vector3 end, Color colour){ Function.Call(Hash.DRAW_LINE, start.X, start.Y, start.Z, end.X, end.Y, end.Z, colour.R, colour.G, colour.B, colour.A);} That will ensure that no matter how the model rotates, the corners will rotate relative to it. This also works for Peds and Props of course, it's not just for Vehicles. I should just add, you should only collect the corner points once and then store those in a class that links those corners with that Vehicle. You don't want to be grabbing model dimensions every frame, it's just wasted cycles if you do that. Or you could create a Dictionary<int, List<Vector3>> that has the model hash as the key and the corner points as the DIctionary value. Like everything, there are many ways to achieve the goal, you just have to find the one that you are most comfortable using. thanks alot for your help:) Link to comment Share on other sites More sharing options...
husseinh Posted October 5, 2017 Author Share Posted October 5, 2017 @LeeC2202 can i get the Coordinates and the Dimensions of the Buildings Around me like what i made by Cars and Peds? Link to comment Share on other sites More sharing options...
Guest Posted October 5, 2017 Share Posted October 5, 2017 (edited) @LeeC2202 can i get the Coordinates and the Dimensions of the Buildings Around me like what i made by Cars and Peds? I don't believe the buildings are simple model files, they are map based entities as far as I am aware. So as far as I know (which is very little when it comes to maps) I don't think you can. I know that's a very ambiguous answer but I don't know enough to say a definite yes or no, sorry. Edited October 5, 2017 by Guest Link to comment Share on other sites More sharing options...
mmuaz Posted October 6, 2017 Share Posted October 6, 2017 @LeeC2202 can i get the Coordinates and the Dimensions of the Buildings Around me like what i made by Cars and Peds? I don't believe the buildings are simple model files, they are map based entities as far as I am aware. So as far as I know (which is very little when it comes to maps) I don't think you can. I know that's a very ambiguous answer but I don't know enough to say a definite yes or no, sorry. @LeeC2202 And what about roads, greenery or sidewalks etc? Do you think any alternating method exist to capture information about them? Link to comment Share on other sites More sharing options...
Guest Posted October 6, 2017 Share Posted October 6, 2017 I am sure there is a way because Camxxcore's Camera Info tool mod does it I think. You need some input from someone with more experience in getting map info, all I have done is basic props, peds and vehicles. Link to comment Share on other sites More sharing options...
husseinh Posted October 9, 2017 Author Share Posted October 9, 2017 @LeeC2202 sorry am asking too much. But i like to know how to detect Animals! i tried using GetPeds(),GetEntities(),GetProps() but no one of them helps!! Link to comment Share on other sites More sharing options...
Guest Posted October 19, 2017 Share Posted October 19, 2017 (edited) @LeeC2202 sorry am asking too much. But i like to know how to detect Animals! i tried using GetPeds(),GetEntities(),GetProps() but no one of them helps!! Peds work perfectly fine to detect animals, as you can see from the image below. I would suggest that in Visual Studio, you look at the properties that a Ped has and the ones you can check against. I am not just going to give you the answer because doing what I have said, is precisely how you learn what an API lets you do. You need to get used to doing that because it answers a lot of questions without you having to ask for the answer. So if you had Ped myPed, then typing myPed followed by a full-stop, would show a list of all the Ped properties. Edited October 19, 2017 by Guest Link to comment Share on other sites More sharing options...