Dev614 Posted November 17, 2017 Share Posted November 17, 2017 (edited) I'm trying to perform the functions GET_PED_TYPE and IS_PED_IN_ANY_VEHICLE on every ped in the ped array of peds near me (using World.GetNearbyPeds(Game.Player.Character.Position, 200f)). I'm stuck here, I'm trying to check for any ped near me that is in a vehicle, and if he is in the vehicle, if he is a gang member and if so, I want to change the relationship group so he no longer attacks "Hated" peds and causes traffic jams. Edited November 17, 2017 by Dev614 Link to comment Share on other sites More sharing options...
ikt Posted November 17, 2017 Share Posted November 17, 2017 Do you know how to iterate over arrays? Link to comment Share on other sites More sharing options...
Dev614 Posted November 17, 2017 Author Share Posted November 17, 2017 (edited) I've been trying to set up a loop to no avail. Would it go something like this? ?? and then follow it with an if statement checking if it's equal to a certain value? I'm just learning to code, forgive my ignorance. Ped[] peds = World.GetNearbyPeds(Game.Player.Character.Position, 200f);foreach (Ped p in peds){ Function.Call(Hash.GET_PED_TYPE);} Or would a for statement be better? Something like: Ped[] peds = World.GetNearbyPeds(Game.Player.Character.Position, 200f);int pedcount = peds.Length;for (int i = 1; i <= pedcount; i++){ Function.Call(Hash.GET_PED_TYPE);} Edited November 17, 2017 by Dev614 Link to comment Share on other sites More sharing options...
Dev614 Posted November 18, 2017 Author Share Posted November 18, 2017 @ikt I've got the script up and running using that foreach function, just a little edited. Thank you for the resource! I was experimenting with the foreach function earlier but I set it up wrong, the resource you shared showed me my error. I appreciate it! Link to comment Share on other sites More sharing options...