public static List <Vehicle> GetVehiclesNearPosition(Vector3 pPosition, float pRadius, GetEntitiesFlags pFlags) { try { List <Entity> entities = World.GetEntities(pPosition, pRadius, pFlags).ToList(); List <Vehicle> vehList = (from x in entities where x.Exists() && x.IsVehicle() select(Vehicle) x).ToList(); vehList = (from x in vehList where x.IsPlayersVehicle() == false select x).ToList(); return(vehList); } catch { return(new List <Vehicle>()); } }
public static List <Ped> GetPedsNearPosition(Vector3 pPosition, float pRadius, GetEntitiesFlags pFlags) { try { List <Entity> entities = World.GetEntities(pPosition, pRadius, pFlags).ToList(); List <Ped> pedList = (from x in entities where x.Exists() && x.IsPed() select(Ped) x).ToList(); pedList = (from x in pedList where x.IsPlayer == false select x).ToList(); return(pedList); } catch { return(new List <Ped>()); } }