foreach(new i : Player){ new vehID = GetPlayerVehicleID(i); if(vehID > 0 && vehID == VehicleIDToCheck) { // Do something... }}